-
Notifications
You must be signed in to change notification settings - Fork 1k
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
graph: backend: kernels: sdp verbose enhancement #2273
Conversation
make test |
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.
Please share some verbose examples for these checks.
for dispatch:
for check:
|
b75abab
to
9b8918d
Compare
make test |
9b8918d
to
5a9ac0b
Compare
make test |
1 similar comment
make test |
5a9ac0b
to
54d590e
Compare
make test |
54d590e
to
efe6e16
Compare
make test |
efe6e16
to
d19d49b
Compare
make test |
} | ||
if (ret != status::success) | ||
VDISPATCH_GRAPH_SDP("fail to dispatch to sdp kernel"); |
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.
I'm thinking to simplify the checks. Is it possible to do the check only before return?
if (ret == status::success)
VDISPATCH_GRAPH_SDP("sdpa is dispatched to (%s)", kernel->str());
else
VDISPATCH_GRAPH_SDP("sdpa is failed to dispatch");
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.
Good idea. changed as suggested
auto op_status = record_input_offset(sg, inputs); | ||
if (op_status != status::success) return false; | ||
VCHECK_SDP_DECOMP(record_input_offset(sg, inputs) == status::success, false, | ||
"Failed to record input offset"); |
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.
Any specific consideration to wrap the record_input_offset()
function into the macro? I feel the below style is easier to read and to step into the function when debug.
auto op_status = record_input_offset(sg, inputs);
VCHECK_SDP_DECOMP(op_status == status::success, false,
"Failed to record input offset");
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.
} | ||
VCHECK_SDP_DECOMP( | ||
batch_size == wei1_user_dims[0] && batch_size == wei2_user_dims[0], | ||
false, "Batch size mismatch"); |
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.
Do we want to also print the values of them?
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.
just added in print
|
||
// Check scale size | ||
if (graph_inport[2] != -1) { | ||
auto scale_sz = ltw(inputs[graph_inport[2]]).nelems(); | ||
if (scale_sz != 1) return false; | ||
VCHECK_SDP_DECOMP(scale_sz == 1, false, | ||
"Scale size in sdp should be 1, but got %d", scale_sz); |
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.
Better to clarify that this is a limitation of the decomp kernel, not sdp.
"Scale size in sdp should be 1, but got %d", scale_sz); | |
"sdp_decomp_kernel_t only supports single scale value, but got %d", scale_sz); |
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.
Okay i see you already have kernel name in the macro, but seems still need to refine. This is a duplication in your example:
onednn_verbose,v1,graph,create:check,sdp_decomp,sdp_decomp_kernel_t: initial check failed,src/graph/backend/dnnl/kernels/sdp_decomp.cpp:56
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.
has removed the duplicated info. thanks for your advice.
#else | ||
return true; | ||
VCHECK_SDP_DECOMP(batch_size * num_head_q > RATIO * nthr, false, | ||
"Batch size * num_head_q should be larger than %d * nthr", RATIO); |
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.
This is also a kernel limitation. I'm not sure if the message clarifies that.
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.
added more info.
@@ -19,6 +19,10 @@ | |||
|
|||
#include "common/compiler_workarounds.hpp" | |||
|
|||
#define VCHECK_SDP_PRIMITIVE(cond, status, msg, ...) \ | |||
VCONDCHECK(graph, create, check, sdp_primitive, (cond), status, msg, \ |
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.
VCONDCHECK(graph, create, check, sdp_primitive, (cond), status, msg, \ | |
VCONDCHECK(graph, create, check, sdp_primitive_kernel_t, (cond), status, msg, \ |
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.
fixed. thanks
} | ||
|
||
VCONDCHECK(graph, create, dispatch, sdp, status == status::success, status, | ||
"could not create primitive, falling back\n"); |
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.
"could not create primitive, falling back\n"); | |
"could not create sdpa primitive, falling back\n"); |
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.
fixed. thanks
d19d49b
to
11a4780
Compare
make test |
11a4780
to
eb3d730
Compare
make test |
eb3d730
to
9bf40d3
Compare
make test |
[Graph API] Code quality improvement: enhancement for SDP