Skip to content

Commit e4c287a

Browse files
committed
matmul: play with alignment, attempt block mult, but it is slow so likely wrong
1 parent 9ab5ca3 commit e4c287a

File tree

3 files changed

+302
-220
lines changed

3 files changed

+302
-220
lines changed

gcc/attribute.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,22 @@ int main() {
394394
395395
Aligns variables on X bit lines.
396396
397-
This may be required for certain processor specific functions.
397+
This may be required for certain processor specific functions, in particular SIMD operations.
398398
399399
The generated gas assembly code should mark this alignment with the `.align` directive.
400400
401401
http://stackoverflow.com/questions/381244/purpose-of-memory-alignment
402+
403+
C11 has aligned_alloc:
404+
405+
- http://stackoverflow.com/questions/227897/how-to-allocate-aligned-memory-only-using-the-standard-library
406+
- http://stackoverflow.com/questions/3839922/aligned-malloc-in-gcc
407+
408+
Assume that function argument pointer is aligned:
409+
http://stackoverflow.com/questions/9608171/how-to-tell-gcc-that-a-pointer-argument-is-always-double-word-aligned
410+
411+
TODO does it work for stack variables?
412+
http://stackoverflow.com/questions/841433/are-stack-variables-aligned-by-the-gcc-attribute-alignedx
402413
*/
403414
{
404415
assert(aligned16 == 0);

gcc/vector.c

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Basically a more abstract and ISA portable (TODO?) version of intrinsics.
55
66
Note however that the GCC and other compiles have an auto-vectorization
77
optimization, which might use SIMD even if you don't use the vector extensions.
8+
9+
TODO: is explicit alignment attribute necessary, or automatically done?
810
*/
911

1012
#include "common.h"

0 commit comments

Comments
 (0)