Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinicore
Commits
b03d744c
Commit
b03d744c
authored
Mar 18, 2025
by
PanZezhong
Browse files
issue/68/fix 整理代码
parent
86c701a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
24 deletions
+23
-24
src/infiniop-test/include/gguf.hpp
src/infiniop-test/include/gguf.hpp
+21
-24
src/infiniop-test/include/ops.hpp
src/infiniop-test/include/ops.hpp
+2
-0
No files found.
src/infiniop-test/include/gguf.hpp
View file @
b03d744c
...
...
@@ -68,35 +68,32 @@ static const size_t GGUF_TYPE_SIZE[GGUF_TYPE_COUNT] = {
inline
std
::
string
ggufDataToString
(
const
uint8_t
*
data
,
GGUF_TYPE
gguf_type
)
{
switch
(
gguf_type
)
{
case
GGUF_TYPE_UINT8
:
return
std
::
to_string
(
*
reinterpret_cast
<
const
uint8_t
*>
(
data
));
case
GGUF_TYPE_INT8
:
return
std
::
to_string
(
*
reinterpret_cast
<
const
int8_t
*>
(
data
));
case
GGUF_TYPE_UINT16
:
return
std
::
to_string
(
*
reinterpret_cast
<
const
uint16_t
*>
(
data
));
case
GGUF_TYPE_INT16
:
return
std
::
to_string
(
*
reinterpret_cast
<
const
int16_t
*>
(
data
));
case
GGUF_TYPE_UINT32
:
return
std
::
to_string
(
*
reinterpret_cast
<
const
uint32_t
*>
(
data
));
case
GGUF_TYPE_INT32
:
return
std
::
to_string
(
*
reinterpret_cast
<
const
int32_t
*>
(
data
));
case
GGUF_TYPE_FLOAT32
:
return
std
::
to_string
(
*
reinterpret_cast
<
const
float
*>
(
data
));
case
GGUF_TYPE_BOOL
:
return
std
::
to_string
(
*
reinterpret_cast
<
const
bool
*>
(
data
));
case
GGUF_TYPE_STRING
:
return
std
::
to_string
(
*
reinterpret_cast
<
const
char
*>
(
data
));
case
GGUF_TYPE_UINT64
:
return
std
::
to_string
(
*
reinterpret_cast
<
const
uint64_t
*>
(
data
));
case
GGUF_TYPE_INT64
:
return
std
::
to_string
(
*
reinterpret_cast
<
const
int64_t
*>
(
data
));
case
GGUF_TYPE_FLOAT64
:
return
std
::
to_string
(
*
reinterpret_cast
<
const
double
*>
(
data
));
#define RETURN_GGUF_DATA(CASE, CTYPE) \
case CASE: \
return std::to_string(*reinterpret_cast<const CTYPE *>(data));
RETURN_GGUF_DATA
(
GGUF_TYPE_UINT8
,
uint8_t
)
RETURN_GGUF_DATA
(
GGUF_TYPE_INT8
,
int8_t
)
RETURN_GGUF_DATA
(
GGUF_TYPE_UINT16
,
uint16_t
)
RETURN_GGUF_DATA
(
GGUF_TYPE_INT16
,
int16_t
)
RETURN_GGUF_DATA
(
GGUF_TYPE_UINT32
,
uint32_t
)
RETURN_GGUF_DATA
(
GGUF_TYPE_INT32
,
int32_t
)
RETURN_GGUF_DATA
(
GGUF_TYPE_FLOAT32
,
float
)
RETURN_GGUF_DATA
(
GGUF_TYPE_BOOL
,
bool
)
RETURN_GGUF_DATA
(
GGUF_TYPE_UINT64
,
uint64_t
)
RETURN_GGUF_DATA
(
GGUF_TYPE_INT64
,
int64_t
)
RETURN_GGUF_DATA
(
GGUF_TYPE_FLOAT64
,
double
)
RETURN_GGUF_DATA
(
GGUF_TYPE_STRING
,
char
)
case
GGUF_TYPE_ARRAY
:
throw
std
::
runtime_error
(
"GGUF_TYPE_ARRAY should be processed element by element"
);
default:
return
"GGUF_TYPE_UNKNOWN"
;
}
#undef RETURN_GGUF_DATA
}
struct
GGUFKeyValue
{
...
...
src/infiniop-test/include/ops.hpp
View file @
b03d744c
...
...
@@ -24,6 +24,8 @@ DECLARE_INFINIOP_TEST(matmul)
}
namespace
infiniop_test
{
// Global variable for {op_name: builder} mappings
extern
std
::
unordered_map
<
std
::
string
,
const
TestBuilder
>
TEST_BUILDERS
;
}
// namespace infiniop_test
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment