-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Add support for TRUNC unary operator (CPU +SYCL) #16032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
75faa5a
29597b7
08c0cec
1f19008
da00061
5c7460c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -559,6 +559,7 @@ extern "C" { | |
|
||
enum ggml_unary_op { | ||
GGML_UNARY_OP_ABS, | ||
GGML_UNARY_OP_TRUNC, | ||
|
||
GGML_UNARY_OP_SGN, | ||
GGML_UNARY_OP_NEG, | ||
GGML_UNARY_OP_STEP, | ||
|
@@ -1027,6 +1028,14 @@ extern "C" { | |
GGML_API struct ggml_tensor * ggml_abs_inplace( | ||
struct ggml_context * ctx, | ||
struct ggml_tensor * a); | ||
|
||
GGML_API struct ggml_tensor * ggml_trunc( | ||
struct ggml_context * ctx, | ||
struct ggml_tensor * a); | ||
|
||
GGML_API struct ggml_tensor * ggml_trunc_inplace( | ||
struct ggml_context * ctx, | ||
struct ggml_tensor * a); | ||
|
||
GGML_API struct ggml_tensor * ggml_sgn( | ||
struct ggml_context * ctx, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -854,7 +854,13 @@ void write_output_files() { | |
fputs(len.c_str(), src); | ||
} | ||
|
||
for (const std::string& btype : {"f16", "f32", "q8_1"}) { | ||
std::vector<std::string> btypes = {"f16", "f32"}; | ||
|
||
#if defined(GGML_VULKAN_INTEGER_DOT_GLSLC_SUPPORT) | ||
btypes.push_back("q8_1"); | ||
#endif | ||
|
||
for (const std::string& btype : btypes) { | ||
for (const auto& tname : type_names) { | ||
Comment on lines
927
to
935
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change should be in a separate PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is my code from #15740, no idea what it is doing here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand what needs fixing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change is in 75faa5a for whatever reason, it should not be a part of that commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fixed it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if (btype == "q8_1" && !is_legacy_quant(tname)) { | ||
continue; | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1127,6 +1127,7 @@ static_assert(GGML_OP_POOL_COUNT == 2, "GGML_OP_POOL_COUNT != 2"); | |||||
|
||||||
static const char * GGML_UNARY_OP_NAME[GGML_UNARY_OP_COUNT] = { | ||||||
"ABS", | ||||||
"ROUND", | ||||||
|
"ROUND", | |
"TRUNC", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error has been corrected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be careful not to add extra files that are not used in the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
This has been fixed.