Skip to content
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

common: promote sparse functionality #2328

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

spalicki
Copy link
Contributor

@spalicki spalicki commented Dec 30, 2024

Promoting experimental sparse functionality - common structures and methods. Currently only CPU x64 matmul and reorder have sparse implementations, the rest is guarded by is_dense_format_kind call in pd init functions.

@spalicki spalicki self-assigned this Dec 30, 2024
@github-actions github-actions bot added documentation A request to change/fix/improve the documentation. Codeowner: @oneapi-src/onednn-doc component:api Codeowner: @oneapi-src/onednn-arch component:tests Codeowner: @oneapi-src/onednn-arch component:build component:examples labels Dec 30, 2024
@spalicki spalicki closed this Feb 21, 2025
@spalicki spalicki force-pushed the spalicki/sparse_promotion branch from 7594c9c to 21ae45b Compare February 21, 2025 00:47
@spalicki spalicki reopened this Feb 21, 2025
@github-actions github-actions bot added the devops Github automation label Feb 21, 2025
@spalicki spalicki force-pushed the spalicki/sparse_promotion branch 5 times, most recently from 9a0e698 to 90e3147 Compare February 25, 2025 19:32
@spalicki
Copy link
Contributor Author

make test

@spalicki spalicki force-pushed the spalicki/sparse_promotion branch from 90e3147 to ed97330 Compare February 26, 2025 18:00
@spalicki spalicki changed the title [WiP] common: promote sparse functionality common: promote sparse functionality Feb 26, 2025
@spalicki spalicki marked this pull request as ready for review March 3, 2025 21:03
@spalicki spalicki requested review from a team as code owners March 3, 2025 21:03
@spalicki spalicki force-pushed the spalicki/sparse_promotion branch from ed97330 to 4f503fa Compare March 4, 2025 01:25
@spalicki
Copy link
Contributor Author

spalicki commented Mar 4, 2025

make test

// macro is defined.
CPU_INSTANCE_SPARSE_X64(jit_uni_sparse_matmul_t)
CPU_INSTANCE_SPARSE(ref_sparse_matmul_t)
CPU_INSTANCE_X64(jit_uni_sparse_matmul_t)
Copy link
Contributor

@densamoilov densamoilov Mar 4, 2025

Choose a reason for hiding this comment

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

Now, when the sparse functionality is not experimental, it is possible to pass sparse memory descriptors when creating any primitive and therefore it could lead to undefined behavior because only matmul and reorder primitives have corresponding checks for memory descriptors.

We need to add such checks to other primitives too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just to expand, I think we should check that at primitive_desc create functions for most primitives.

@@ -75,7 +75,6 @@ dnnl_status_t DNNL_API dnnl_ocl_interop_memory_create(dnnl_memory_t *memory,
const_dnnl_memory_desc_t memory_desc, dnnl_engine_t engine,
dnnl_ocl_interop_memory_kind_t memory_kind, void *handle);

#ifdef DNNL_EXPERIMENTAL_SPARSE
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't have get_mem_object and set_mem_object functions that would take indices. I don't think it's critical, but just need to have that in mind as we may have to add it later on.

Copy link
Contributor

@densamoilov densamoilov left a comment

Choose a reason for hiding this comment

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

LGTM. Please address the issue with sparse reorder.

@spalicki spalicki force-pushed the spalicki/sparse_promotion branch 2 times, most recently from 8b59600 to 965c9b1 Compare March 13, 2025 03:33
@spalicki spalicki requested review from a team as code owners March 13, 2025 03:33
@spalicki spalicki force-pushed the spalicki/sparse_promotion branch 2 times, most recently from 363d4bb to 04cdc16 Compare March 17, 2025 19:06
@spalicki spalicki force-pushed the spalicki/sparse_promotion branch from 04cdc16 to 8904c86 Compare March 25, 2025 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:api Codeowner: @oneapi-src/onednn-arch component:build component:examples component:tests Codeowner: @oneapi-src/onednn-arch devops Github automation documentation A request to change/fix/improve the documentation. Codeowner: @oneapi-src/onednn-doc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants