A demo of matrix multiplication using SIMD (AVX2 + FMA3)
Please note that the code generated by OpenAI-GPT4 is incorrect and unable to produce accurate results. Therefore, I have made modifications and corrected its mistakes.
Matrix_A
55.6195 7.44062 71.1846 15.7598 96.3941 2.8273 78.6832 67.8947
42.4522 69.0849 69.0338 31.8491 85.6873 20.8099 93.9552 79.0704
77.8971 87.4415 1.41261 40.8256 54.7363 43.8162 95.6432 18.6574
60.0911 64.3748 8.17632 47.1227 56.5681 14.2987 60.9073 78.9767
13.0455 11.6228 68.7402 42.9468 29.4139 75.9694 57.9314 56.6625
64.3159 53.1018 0.164158 43.3898 14.541 60.5806 56.5587 81.9546
40.1409 1.63238 21.2841 0.520787 17.5271 20.6284 3.19299 81.346
29.3985 33.7534 78.2684 98.9039 88.3477 49.7525 12.1332 48.8632
Matrix_B
48.0372 66.2428 2.66032 89.3206 68.3135 67.3493 3.32513 90.2504
68.6358 69.2998 8.71592 23.1085 23.0823 49.2819 32.3515 42.3496
12.9408 28.5193 29.7087 5.93843 57.5937 84.8108 67.4169 94.0663
85.8718 4.49808 26.1466 39.8701 58.569 66.6801 8.09702 70.5492
62.5569 6.33547 79.1994 46.7611 97.7964 77.0937 48.3692 42.2809
16.2025 68.8403 97.8366 99.8947 51.156 52.818 18.4424 23.8405
22.2429 42.1988 15.8494 95.1886 10.2524 50.4308 69.7989 99.5131
29.5823 37.0394 3.48851 87.2987 36.6077 82.0087 56.9845 62.9774
Correct result
15291.5 12941.5 12134.6 24397.8 21857.9 28317.4 19427.9 29391.6
20535.7 18580.7 14186 28999.9 23638.3 33170.1 22880.3 33946.2
20081 19533.9 12281.7 28284 19070.3 25285.2 14708.3 27798.1
18918.8 15725.1 9315.9 25548.1 18601 25719.8 14966.8 26010.5
12037.6 13782.7 14179.1 22979.7 17064.9 23993.5 15497.6 23553.8
16036 17825 10034.3 27972.7 16271.3 23749.8 12732.6 23978.6
6268.54 8060.38 4507.69 14055.9 9816.16 13896.6 7711.95 12404.3
21283.1 13270.1 17511.1 22335.9 26186.3 30934.3 16089.4 27628.9
OpenAI-GPT4's result
15374.4 16411.2 12467.8 22229.6 18839 25289.5 13590.7 26315.3
14380.9 13112.1 11162.3 14297 16014.9 22165.4 12254.9 20409.7
15969.7 13820.5 7117.44 20377.4 16830.9 21661.5 11905.1 20015.2
13844.9 11571.8 10764.2 19291.3 16968.7 22975.5 12766.5 19066.7
21156.7 19338.3 8446.69 25379.5 22062.8 30293.9 15189.5 30366.5
11023.6 10308.3 14308.7 17474.7 16595.9 20062.4 12819.2 16109.2
21666.7 19569.6 15676.8 21917.5 25655.3 30711.9 15001.8 29253.6
23839.2 22107.8 17454.6 33996.5 24520 32124.5 17395.6 32324.7