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

[Operator] Adding CPU support for matrix multiplication #251

Merged
merged 114 commits into from
May 28, 2023

Conversation

BolinSNLHM
Copy link
Contributor

No description provided.

Copy link
Member

@yaoyaoding yaoyaoding left a comment

Choose a reason for hiding this comment

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

Thanks @BolinSNLHM! Nice to see that hidet is getting to have better support for cpu backend.

As your first PR, it looks great! I left some comments. Please also add a test case in hidet/tests/operators/test_matmul.py to test your new operator.

.gitignore Outdated Show resolved Hide resolved
python/hidet/backend/build.py Show resolved Hide resolved
python/hidet/backend/build.py Outdated Show resolved Hide resolved
python/hidet/backend/codegen.py Outdated Show resolved Hide resolved
python/hidet/ffi/runtime_api.py Outdated Show resolved Hide resolved
python/hidet/graph/ops/__init__.py Outdated Show resolved Hide resolved
python/hidet/lang/__init__.py Outdated Show resolved Hide resolved
Comment on lines 308 to 314
def matmul_kernel_x86(a_ptr: ~float32, b_ptr: ~float32, c_ptr: ~float32):
a = as_tensor_pointer(a_ptr, dtype=float32, shape=[m_size, k_size])
b = as_tensor_pointer(b_ptr, dtype=float32, shape=[k_size, n_size])
c = as_tensor_pointer(c_ptr, dtype=float32, shape=[m_size, n_size])
mbs = (m_size + block_m - 1) // block_m
nbs = (n_size + block_n - 1) // block_n
kbs = (k_size + block_k - 1) // block_k
Copy link
Member

Choose a reason for hiding this comment

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

If we declare kernel function in this way (use pointer as input instead of directly declare the input tensor), we will not support prologue/epilogue fusion. In this case, we should override the allow_prologue(...) and allow_epilogue(...) to return False. A better way is to disable prologue fusion and enable epilogue fusion, and decalre c as the tensor directly in the parameter list.

BolinSNLHM and others added 5 commits May 27, 2023 13:06
@BolinSNLHM BolinSNLHM requested a review from yaoyaoding May 27, 2023 23:15
@yaoyaoding
Copy link
Member

Thanks @BolinSNLHM !

@yaoyaoding yaoyaoding merged commit 3c6579e into hidet-org:main May 28, 2023
vadiklyutiy pushed a commit that referenced this pull request Jul 22, 2024
Added advanced tensor indexing. I had to create a new task called
"AdvancedIndexingTask". Otherwise it will not work with dynamic shapes.

---------

Co-authored-by: Zhumakhan <nazirzhumakhan@gmail,.com>
vadiklyutiy pushed a commit that referenced this pull request Jul 23, 2024
Added advanced tensor indexing. I had to create a new task called
"AdvancedIndexingTask". Otherwise it will not work with dynamic shapes.

---------

Co-authored-by: Zhumakhan <nazirzhumakhan@gmail,.com>
vadiklyutiy pushed a commit that referenced this pull request Dec 26, 2024
Added advanced tensor indexing. I had to create a new task called
"AdvancedIndexingTask". Otherwise it will not work with dynamic shapes.

---------

Co-authored-by: Zhumakhan <nazirzhumakhan@gmail,.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants