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

BF16 on AMD CPU? #806

Closed
moderato opened this issue May 1, 2024 · 4 comments
Closed

BF16 on AMD CPU? #806

moderato opened this issue May 1, 2024 · 4 comments

Comments

@moderato
Copy link

moderato commented May 1, 2024

Hi there, I saw there is some code in the sandbox/power10 folder for BF16 GEMM. I suppose that is just for POWER10 machines? Is it possible to build and run code with bli_sbgemm on AMD CPU? Thanks!

@fgvanzee
Copy link
Member

fgvanzee commented May 1, 2024

Hi there, I saw there is some code in the sandbox/power10 folder for BF16 GEMM. I suppose that is just for POWER10 machines? Is it possible to build and run code with bli_sbgemm on AMD CPU? Thanks!

Thanks for your question. Yes, that code is specific to POWER10 systems. The author (@nicholaiTukanov) likely did not intend for it to run on AMD CPUs. That said, we always encourage power users (pun not intended) to tinker around and see what you can get working!

@moderato
Copy link
Author

moderato commented May 2, 2024

Hi there, I saw there is some code in the sandbox/power10 folder for BF16 GEMM. I suppose that is just for POWER10 machines? Is it possible to build and run code with bli_sbgemm on AMD CPU? Thanks!

Thanks for your question. Yes, that code is specific to POWER10 systems. The author (@nicholaiTukanov) likely did not intend for it to run on AMD CPUs. That said, we always encourage power users (pun not intended) to tinker around and see what you can get working!

Thanks for the reply. Does that mean there is no BF16 support for AMD CPUs for now?

@BhaskarNallani
Copy link
Contributor

BhaskarNallani commented May 2, 2024

Hi Zhongyi Lin,

You can use BF16 implementation designed for zen4 and above, which are available in aocl_gemm addon in amd/blis https://github.com/amd/blis/tree/master/addon/aocl_gemm

You can build clone amd version of blis and build with aocl_gemm addon and call one of the below api's which has similar arguments, one can pass null for post-ops structure argument if intended to use only for gemm. API definitions available in this file https://github.com/amd/blis/blob/master/addon/aocl_gemm/aocl_gemm_interface_apis.h

aocl_gemm_bf16bf16f32of32( ) - This API accumulates at float (f32) precision and gives the output in float (f32)
aocl_gemm_bf16bf16f32obf16( ) - This API accumulates at float (f32) precision and gives the output in bf16 format (which is half the size)

Bhaskar

@moderato
Copy link
Author

moderato commented May 2, 2024

Hi Zhongyi Lin,

You can use BF16 implementation designed for zen4 and above, which are available in aocl_gemm addon in amd/blis https://github.com/amd/blis/tree/master/addon/aocl_gemm

You can build clone amd version of blis and build with aocl_gemm addon and call one of the below api's which has similar arguments, one can pass null for post-ops structure argument if intended to use only for gemm. API definitions available in this file https://github.com/amd/blis/blob/master/addon/aocl_gemm/aocl_gemm_interface_apis.h

aocl_gemm_bf16bf16f32of32( ) - This API accumulates at float (f32) precision and gives the output in float (f32) aocl_gemm_bf16bf16f32obf16( ) - This API accumulates at float (f32) precision and gives the output in bf16 format (which is half the size)

Bhaskar

Hi Bhaskar, thank you for this valuable information. Will try and let you know.

@moderato moderato closed this as completed May 2, 2024
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

No branches or pull requests

3 participants