<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span>Hello</span><div><span><br></span></div><div><span>thank you for explanation</span><div><span><br></span><span>>But currently those usages won't involve v6+ yet</span><span><br></span><span>I found one usage of v6+:</span><span><br></span><span>src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp:</span></div><div><span><br></span></div><div><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgb(15, 104, 160); background-color: rgb(255, 255, 255);"><span style="color: #9b2393"><b>void</b></span><span style="color: rgba(0, 0, 0, 0.85)"> </span>C2_MacroAssembler<span style="color: rgba(0, 0, 0, 0.85)">::</span>string_compare_v(…)</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgb(15, 104, 160); background-color: rgb(255, 255, 255);"><br></p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgb(15, 104, 160); background-color: rgb(255, 255, 255);">…</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"> VectorRegister vstr1 = encLU ? v4 : v0; //vstr1 could be v4</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"> VectorRegister vstr2 = encLU ? v0 : v4;</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255); min-height: 14px;"><br></p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"> bind(loop);</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"> vsetvli(tmp1, cnt2, Assembler::e8, Assembler::m2);</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"> vle8_v(vstr1, strL);</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"> vsetvli(tmp1, cnt2, Assembler::e16, Assembler::m4); //lmul=4</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"> vzext_vf2(vstr2, vstr1);</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"> vle16_v(vstr1, strU); //usage of v4/v5/v6/v7</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);">…</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"><br></p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);">vstr1 could be v4.</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"><br></p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);">after second vsetvli, we set lmul to 4, so v4 represents also v5, v6, v7</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"><br></p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);">then we load some bytes from memory into vstr1 which stands for v4/v5/v6/v7 combo</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"><br></p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);">I was also able to redo the vector support for vectors 0.7.1 and run it on real hardware ( thead, it has two c910 without vectors and one c910 with vectors, only one of sets can work at a time.), going to prepare some performance results, using openjdk’s microtests.</p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);"><br></p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255);">Regards, Vladimir</p><span><br><blockquote type="cite">23 мая 2023 г., в 03:52, yangfei@iscas.ac.cn написал(а):<br><br class="Apple-interchange-newline">Hi,<br><br>Comments inlined.<br><br>> -----Original Messages-----<br>> From: "Vladimir Kempik" <vladimir.kempik@gmail.com><br>> Sent Time: 2023-05-23 04:44:38 (Tuesday)<br>> To: riscv-port-dev <riscv-port-dev@openjdk.org><br>> Cc: <br>> Subject: question about vector registers<br>> <br>> Hello<br>> <br>> I have few questions about vector registers usage in hotspot.<br>> <br>> Currently there is no calling convention for vector registers [1].<br>><br>> Currently all vector registers ( usage in hotspot) are not preserved and volatile ? is it true ?<br><br>Yes, the ABI spec only mentions that vector registers are volatile and are not used for passing arguments or return values for now.<br>So if you look at register definition for C2, we set both 'register save type' and 'C convention save type' for vector registers as SOC (Save-On-Call).<br><br>> why do we have defition for v1_reg-v5_reg and the rest of the registers ( except v0_mask) ?<br><br>Several vector registers (including v0_mask register) are used as scratch registers to optimize code for C2 nodes like ClearArray, StrComp, etc.<br>And if you do this, remember to make this explicit on the side effect for those nodes like: https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/riscv_v.ad#L3278<br><br>> I guess some v6+ could be used somewhere due to lmul = 2 or 4.<br><br>I think it will depend on your specific usage then.<br>We already have some use of lmul =2/4 in some C2 assembler functions like C2_MacroAssembler::clear_array_v.<br>But currently those usages won't involve v6+ yet.<br><br>Hope that answers the questions,<br>Fei Yang<br></riscv-port-dev@openjdk.org></vladimir.kempik@gmail.com></blockquote><br><br></span><div></div></div></div></body></html>