Skip to content

Conversation

@TianHao324
Copy link

@TianHao324 TianHao324 commented Nov 20, 2025

The CANN backend supports floating-point product calculations.

@noemotiovon noemotiovon added the Ascend NPU issues specific to Ascend NPUs label Nov 20, 2025
@TianHao324 TianHao324 changed the title cann supports out_prod operator for F32 and F16 CANN: supports out_prod operator for F32 and F16 Nov 20, 2025
@TianHao324
Copy link
Author

test result
image

Copy link
Collaborator

@noemotiovon noemotiovon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a minor issue.


const int64_t i12 = i2;
const int64_t i13 = i3;
aclTensor *accumulator = ggml_cann_create_tensor(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result of ggml_cann_create_tensor should be acl_tensor_ptr, not aclTensor*.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edited

*/
void ggml_cann_out_prod(ggml_backend_cann_context & ctx, ggml_tensor * dst);

void ggml_cann_out_prod_fp(ggml_backend_cann_context & ctx, ggml_tensor * dst);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edited

#include <aclnnop/aclnn_index_select.h>
#include <aclnnop/aclnn_clamp.h>
#include <aclnnop/aclnn_threshold.h>
#include <aclnnop/aclnn_ger.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use
find ggml/src/ggml-cann -iname ".cpp" -o -iname ".h" | xargs clang-format -i
to format code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edited

#include <aclnnop/aclnn_index_select.h>
#include <aclnnop/aclnn_clamp.h>
#include <aclnnop/aclnn_threshold.h>
#include <aclnnop/aclnn_ger.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use
find ggml/src/ggml-cann -iname ".cpp" -o -iname ".h" | xargs clang-format -i
to format code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edited

dst->nb,
2);

GGML_CANN_CALL_ACLNN_OP(ctx, InplaceZero, accumulator);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, InplaceZero is being called on each iteration of the for loop. I believe we can just call it once on dst before the loop.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edited

@github-actions github-actions bot added the ggml changes relating to the ggml tensor library for machine learning label Nov 20, 2025
@TianHao324 TianHao324 force-pushed the out_prod branch 3 times, most recently from 815e770 to 5d9578a Compare November 20, 2025 11:45
@noemotiovon
Copy link
Collaborator

Thank you for your contribution! :)

* DGX Spark: UMA support

* Updates from PR feedback

* More PR feedback cleanup

* Update ggml/src/ggml-cuda/ggml-cuda.cu

Co-authored-by: Georgi Gerganov <[email protected]>

* Remove trailing whitespace

* Update ggml/src/ggml-cuda/ggml-cuda.cu

---------

Co-authored-by: Georgi Gerganov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ascend NPU issues specific to Ascend NPUs ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants