Skip to content

Commit

Permalink
#EDITS: adding some very broken assembly for dgemm routine
Browse files Browse the repository at this point in the history
  • Loading branch information
akielaries committed Feb 21, 2024
1 parent 443053d commit 9a2dfac
Show file tree
Hide file tree
Showing 10 changed files with 1,453 additions and 17 deletions.
19 changes: 19 additions & 0 deletions experiment/test.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.globl asm_function
asm_function:
// Assembly code to add two integers
// Parameters are passed in registers: a in %edi, b in %esi
// Result is stored in %eax
// Load a into %eax
mov %edi, %eax

// Add b to %eax
add %esi, %eax

// Add c to %eax
add %edx, %eax

// Subtract d from %eax
sub %ecx, %eax

ret // Return

21 changes: 21 additions & 0 deletions experiment/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <stdio.h>

// Declare the assembly function as an external function
extern int asm_function(int a, int b, int c, int d);

int add (int a, int b, int c) {
int d = 2;

return asm_function(a, b, c, d);
}

int main() {
int a = 5;
int b = 7;
int c = 10;
//int result = asm_function(5, 7);
int result = add(a, b, c);
printf("Result: %d\n", result);
return 0;
}

6 changes: 3 additions & 3 deletions include/linalg/_dgemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ namespace linalg {
class DGEMM {
public:
/**< Buffer for storing packed micro panels of A */
static double DGEMM_BUFF_A[BLOCK_SZ_M * BLOCK_SZ_K];
static double DGEMM_BUFF_A[BLOCK_SZ_M * BLOCK_SZ_K]__attribute__ ((aligned (16)));
/**< Buffer for storing packed micro panels of B */
static double DGEMM_BUFF_B[BLOCK_SZ_K * BLOCK_SZ_N];
static double DGEMM_BUFF_B[BLOCK_SZ_K * BLOCK_SZ_N]__attribute__ ((aligned (16)));

Check notice on line 55 in include/linalg/_dgemm.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

include/linalg/_dgemm.hpp#L55

class member 'DGEMM::DGEMM_BUFF_B' is never used.
/**< Buffer for storing intermediate results */
static double DGEMM_BUFF_C[BLOCK_SZ_MR * BLOCK_SZ_NR];
static double DGEMM_BUFF_C[BLOCK_SZ_MR * BLOCK_SZ_NR]__attribute__ ((aligned (16)));

Check notice on line 57 in include/linalg/_dgemm.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

include/linalg/_dgemm.hpp#L57

class member 'DGEMM::DGEMM_BUFF_C' is never used.

/**
* @brief Packs micro panels of size BLOCK_SZ_MR rows by k columns from A
Expand Down
7 changes: 7 additions & 0 deletions modules/linalg/dgemm_asm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef DGEMM_ASM_H
#define DGEMM_ASM_H



#endif

Loading

0 comments on commit 9a2dfac

Please sign in to comment.