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

Add CMO extension intrinsics #93

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

Conversation

Liaoshihua
Copy link
Contributor

Add CMO extension intrinsics description.

|`+void __riscv_cbo_flush(void *addr);+` |`cbo.flush` |Zicbom
|`+void __riscv_cbo_inval(void *addr);+` |`cbo.inval` |Zicbom
|`+void __riscv_cbo_zero(void *addr);+` |`cbo.zero` |Zicboz
|`+void __riscv_cbo_prefetch(void *addr, const int rw, const int locality);+` |`prefetch.[r][w]` |Zicbop
Copy link
Contributor

Choose a reason for hiding this comment

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

Is __riscv_cbo_prefetch a wrapper around __builtin_prefetch where there are 4 possible localities? RISC-V supports 5 localities, 4 NTL hint prefixes and 1 without any prefix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is __builtin_prefetch's wrapper. The 4 NTL hint maping had been included in Prefetch Intrinsics part on this doc. So, this commit only support a wrapper for __builtin_prefetch on zicbop extension.

@yulong18 yulong18 mentioned this pull request Oct 26, 2024
@yulong18
Copy link

I follow the documentation to set the __riscv_cbo_prefetchi parameter type, but I get such an error that is invalid argument to built-in function. So, I think the authour need to redefine the parameter type.

@topperc
Copy link
Contributor

topperc commented Oct 26, 2024

I follow the documentation to set the __riscv_cbo_prefetchi parameter type, but I get such an error that is invalid argument to built-in function. So, I think the authour need to redefine the parameter type.

The rw and locality argument to __builtin_prefetch must be compile time constants. You'll need to use a macro instead of a function.

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.

3 participants