Bug 460616

Summary: disInstr(arm64): unhandled instruction 0x4E819402 (dotprod/ASIMDDP)
Product: [Developer tools] valgrind Reporter: edeturk32
Component: memcheckAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal CC: joost.vandevondele, mark, wash
Priority: NOR    
Version: 3.20 GIT   
Target Milestone: ---   
Platform: RedHat Enterprise Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: archive containing sdot.c and valgrind output
Patch to add FEAT_DotProd support
Patch to add FEAT_DotProd support

Description edeturk32 2022-10-17 18:26:38 UTC
Created attachment 152956 [details]
archive containing sdot.c and valgrind output

The instruction is Arm64 SIMD sdot (vector):
https://developer.arm.com/documentation/100069/0609/A64-SIMD-Vector-Instructions/SDOT--vector-

Decoding specification can be found in the Arm Architecture Reference manual:
https://developer.arm.com/documentation/ddi0487/latest

I'm using a machine that supports this instruction. The process does not receive a SIGILL when I run the program without valgrind

STEPS TO REPRODUCE
1. Compile the attached source file with "gcc -march='armv8.2-a+dotprod' -o sdot -c sdot.c" with gcc 9
2. Run "valgrind --tool=memcheck sdot"
3. Disassemble at the unhandled instruction address, e.g. "objdump --disassemble --start-address 0x4006ac --stop-address 0x4006b0 sdot"

Thanks for your help!
Comment 1 William Ashley 2023-07-27 15:25:28 UTC
Created attachment 160568 [details]
Patch to add FEAT_DotProd support

I have implemented support for the dot product instructions (more specifically those under the FEAT_DotProd feature). The attached patch file applies cleanly to 'master' as of this writing. I haven't yet figured out the 'correct' process for submitting changes to the valgrind project.
Comment 2 William Ashley 2023-07-31 14:50:30 UTC
On Friday I submitted the change to the valgrind-developers mailing list, https://sourceforge.net/p/valgrind/mailman/valgrind-developers/thread/ED40273D-295D-445C-8D97-9FC48F535932@amazon.com/
Comment 3 William Ashley 2023-08-01 20:24:34 UTC
Created attachment 160669 [details]
Patch to add FEAT_DotProd support
Comment 4 Mark Wielaard 2023-11-09 23:09:42 UTC
Found a cfarm machine that supports ASIMDDP.
Comment 5 Mark Wielaard 2023-11-10 16:57:04 UTC
This was a really good patch. Thanks.
Only added a NEWS entry, then pushed as:

commit f42b9a434e12bc14ec821183a69b86e91da0577c
Author: William Ashley <wash@amazon.com>
Date:   Fri Nov 10 17:51:12 2023 +0100

    Bug 460616 - Add support for aarch64 dotprod instructions
    
    This change adds support for the FEAT_DotProd instructions
    SDOT <Vd>.<Ta>, <Vn>.<Tb>, <Vm>.4B[<index>]
    SDOT <Vd>.<Ta>, <Vn>.<Tb>, <Vm>.<Tb>
    UDOT <Vd>.<Ta>, <Vn>.<Tb>, <Vm>.4B[<index>]
    UDOT <Vd>.<Ta>, <Vn>.<Tb>, <Vm>.<Tb>
Comment 6 William Ashley 2023-11-10 17:11:45 UTC
Thanks Mark!
Comment 7 Paul Floyd 2024-04-01 18:22:21 UTC
*** Bug 484742 has been marked as a duplicate of this bug. ***