RFR: 8315841: RISC-V: Check for hardware TSO support [v8]
Ludovic Henry
luhenry at openjdk.org
Fri Sep 8 07:34:42 UTC 2023
On Fri, 8 Sep 2023 06:48:37 GMT, Robbin Ehn <rehn at openjdk.org> wrote:
>> src/hotspot/cpu/riscv/vm_version_riscv.cpp line 213:
>>
>>> 211: }
>>> 212:
>>> 213: #ifdef __riscv_ztso
>>
>> May I ask where is this `__riscv_ztso` macro defined / specified? I tried to search it in the gcc user manual [1] and gcc source code, but I found nothing about it.
>>
>> [1] https://gcc.gnu.org/onlinedocs/gcc.pdf
>
> Good question, I don't find docs in the compilers for this either, but:
> https://github.com/riscv-non-isa/riscv-toolchain-conventions#cc-preprocessor-definitions
We checked for it with [this simple snippet](https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:2,lang:c%2B%2B,selection:(endColumn:1,endLineNumber:8,positionColumn:1,positionLineNumber:8,selectionStartColumn:1,selectionStartLineNumber:8,startColumn:1,startLineNumber:8),source:'int+main(void)+%7B%0A%23ifdef+__riscv_ztso%0A++++return+0%3B%0A%23else%0A++++return+1%3B%0A%23endif%0A%7D%0A'),l:'5',n:'0',o:'C%2B%2B+source+%232',t:'0')),k:51.29770473331974,l:'4',m:100,n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:rv64-gcctrunk,deviceViewOpen:'1',filters:(b:'0',binary:'1',binaryObject:'1',commentOnly:'0',debugCalls:'1',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'0',trim:'1'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:2,lang:c%2B%2B,libs:!(),options:'-O2+-march%3Drv64gcv_ztso0p1',overrides:!(),selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,star
tColumn:1,startLineNumber:1),source:2),l:'5',n:'0',o:'+RISC-V+(64-bits)+gcc+(trunk)+(Editor+%232)',t:'0'),(h:compiler,i:(compiler:rv64-clang,deviceViewOpen:'1',filters:(b:'0',binary:'1',binaryObject:'1',commentOnly:'0',debugCalls:'1',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'0',trim:'1'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:3,lang:c%2B%2B,libs:!(),options:'-O2+-march%3Drv64gcv_ztso0p1+-menable-experimental-extensions',overrides:!(),selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:2),l:'5',n:'0',o:'+RISC-V+rv64gc+clang+(trunk)+(Editor+%232)',t:'0')),header:(),k:48.70229526668027,l:'4',m:100,n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4). You can see that in both cases, it returns `0` which implies TSO is enabled.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15613#discussion_r1319481853
More information about the hotspot-dev
mailing list