goankur commented on code in PR #13572: URL: https://github.com/apache/lucene/pull/13572#discussion_r1680353139
########## lucene/core/build.gradle: ########## @@ -14,10 +14,43 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +plugins { + id "c" +} apply plugin: 'java-library' +apply plugin: 'c' description = 'Lucene core library' +model { + toolChains { + gcc(Gcc) { + target("linux_aarch64"){ + cppCompiler.withArguments { args -> + args << "-O3 --shared" Review Comment: Thanks for reviewing this @rmuir. I tried `-O3 -march=armv8.2-a+dotprod` ([recommended flag per AWS graviton documentation](https://github.com/aws/aws-graviton-getting-started/blob/main/c-c++.md#enabling-arm-architecture-specific-features)) on my AWS `m6g.4xlarge` (Graviton2) instance type with ` GCC 10.5.0` to compile the code snippet below but it always seems to give incorrect (0) result. I am trying to understand why `vdotq_s32` has no effect but currently hitting a wall. ``` int vdot8s(char vec1[], char vec2[], int limit) { int result = 0; int32x4_t accum = vdupq_n_s32(0); int i = 0; for (; i+16 <= limit; i+=16 ) { // Read into 8 (bit) x 16 (values) vector int8x16_t v1 = vld1q_s8((const int8_t*) (vec1 + i)); int8x16_t v2 = vld1q_s8((const int8_t*) (vec2 + i)); vdotq_s32(accum, v1, v2); } // REDUCE: Add every vector element in target and write result to scalar result += vaddvq_s32(accum); // Scalar tail. TODO: Use FMA for (; i < limit; i++) { result += vec1[i] * vec2[i]; } printf("Results: %d\n", result); return result; } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org