RFR: 8356159: RISC-V: Add Zabha [v9]

Fei Yang fyang at openjdk.org
Tue May 27 11:06:53 UTC 2025


On Tue, 27 May 2025 10:07:49 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

>> src/hotspot/cpu/riscv/riscv.ad line 5263:
>> 
>>> 5261:   match(Set res (CompareAndSwapB mem (Binary oldval newval)));
>>> 5262: 
>>> 5263:   ins_cost(LOAD_COST + STORE_COST + ALU_COST * 10 + BRANCH_COST * 4);
>> 
>> You might want to align the `ins_cost` with the I & L variants as well. Same for compareAndSwapS.
>
> I have been looking at the ins_cost. When using amocas I think a much better estimate is (for low end):
> 20xDEFAULT_COST / 2xVOLATILE_REF_COST (which is the same what arm uses)
> 
> Argubly more as a plain fence is VOLATILE_REF_COST and as amocases may miss cache (i.e. contended or not speculated).
> 
> We now have 38xDEFAULT_COST for lr/sc/amocas: what you reckon ?
> 
> Side note, that branches are 2xDEFAULT_COST (two alu's) - seems wrong, at least on larger OO.
> We clearly see much higher cost in gem5.

Yeah, 2 * VOLATILE_REF_COST seems more reasonable to me. Seems the current setting is there from day 1 and I cann't recall the details (Maybe adapted from the narrow B/S variants???). Do you want to address this here? Or maybe another PR? I am OK either way.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25252#discussion_r2108889811


More information about the hotspot-dev mailing list