Skip to content

[Operator] Adding CPU support for matrix multiplication#251

Merged
yaoyaoding merged 114 commits intohidet-org:mainfrom
BolinSNLHM:cpu-matmul
May 28, 2023
Merged

[Operator] Adding CPU support for matrix multiplication#251
yaoyaoding merged 114 commits intohidet-org:mainfrom
BolinSNLHM:cpu-matmul

Conversation

@BolinSNLHM
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
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.

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
Copy Markdown
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
Copy Markdown
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