Closed baikangbo closed 4 months ago
The FlashAttention kernel uses floating-point division instructions which are not supported by the default hardware configuration. Emulation is required, or you can use the fdiv.hjson
hardware configuration, which instantiates an FDIV/SQRT unit in the FPU. That should solve the issue.
I followed the tutorial and used Docker to run the Verilator simulation, with the software code /apps/dnn/flashattenion_2. However, I encountered the following error during the simulation:
VCD wave generation enabled [fesvr] Wrote 36 bytes of bootrom to 0x1000 [fesvr] Wrote entry point 0x80000000 to bootloader slot 0x1020 [fesvr] Wrote 56 bytes of bootdata to 0x1024 [Tracer] Logging Hart 8 to logs/trace_hart_00000008.dasm [Tracer] Logging Hart 0 to logs/trace_hart_00000000.dasm [Tracer] Logging Hart 1 to logs/trace_hart_00000001.dasm [Tracer] Logging Hart 2 to logs/trace_hart_00000002.dasm [Tracer] Logging Hart 3 to logs/trace_hart_00000003.dasm [Tracer] Logging Hart 4 to logs/trace_hart_00000004.dasm [Tracer] Logging Hart 5 to logs/trace_hart_00000005.dasm [Tracer] Logging Hart 6 to logs/trace_hart_00000006.dasm [Tracer] Logging Hart 7 to logs/trace_hart_00000007.dasm [Illegal Instruction Core 0] PC: 00008000b140 Data: 18317153 [Illegal Instruction Core 1] PC: 00008000b140 Data: 18317153 [Illegal Instruction Core 2] PC: 00008000b140 Data: 18317153 [Illegal Instruction Core 6] PC: 00008000b140 Data: 18317153 [Illegal Instruction Core 4] PC: 00008000b140 Data: 18317153 [Illegal Instruction Core 0] PC: 000000000000 Data: 00000000 [Illegal Instruction Core 1] PC: 000000000000 Data: 00000000 [Illegal Instruction Core 2] PC: 000000000000 Data: 00000000 [Illegal Instruction Core 6] PC: 000000000000 Data: 00000000 [Illegal Instruction Core 4] PC: 000000000000 Data: 00000000 [Illegal Instruction Core 0] PC: 000000000000 Data: 00000000 [Illegal Instruction Core 1] PC: 000000000000 Data: 00000000 [Illegal Instruction Core 2] PC: 000000000000 Data: 00000000 [Illegal Instruction Core 6] PC: 000000000000 Data: 00000000 [Illegal Instruction Core 4] PC: 000000000000 Data: 00000000 ......
I checked the instruction at address 8000b140, and the content is as follows: 8000b140: 53 71 31 18 fdiv.s ft2, ft2, ft3 How can I solve this error and run the simulation correctly? I encountered similar errors in other test cases (such as gelu, softmax). Thank you very much