Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use upstream LLVM with generic runtime #49

Merged
merged 12 commits into from
Jan 8, 2024
Merged

Conversation

JosseVanDelm
Copy link
Contributor

@JosseVanDelm JosseVanDelm commented Dec 21, 2023

Solves #48

Note that there are still two linking dependencies that I'm hauling over from the old toolchain.
In KULeuven-MICAS/snax_cluster#57 this toolchain was installed by default, here I have to explicitly keep it in the installation but also copy over the static libraries.

@JosseVanDelm JosseVanDelm self-assigned this Dec 21, 2023
@JosseVanDelm JosseVanDelm force-pushed the Josse/add-upstream-llvm branch 2 times, most recently from bc9aa05 to e335786 Compare December 21, 2023 16:41
@JosseVanDelm JosseVanDelm linked an issue Dec 22, 2023 that may be closed by this pull request
9 tasks
@JosseVanDelm JosseVanDelm force-pushed the Josse/add-upstream-llvm branch from 59194e0 to 3d4e6fc Compare December 22, 2023 14:59
@JosseVanDelm JosseVanDelm marked this pull request as ready for review December 22, 2023 15:01
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

@JosseVanDelm
Copy link
Contributor Author

Using the files and building locally,
Undoing #46

I have these issues:

Simple copy ❌

 main.c:28:5: warning: implicit declaration of function '_mlir_ciface_simple_copy' is invalid in C99 [-Wimplicit-function-declaration]
    _mlir_ciface_simple_copy(&memrefA, &memrefB);
    ^ 

In clang 17 this is an error instead of a warning, and the function has to be declared before it can be used.

diff --git a/kernels/simple_copy/main.c b/kernels/simple_copy/main.c
index eeed3fc..0e1fa5a 100644
--- a/kernels/simple_copy/main.c
+++ b/kernels/simple_copy/main.c
@@ -5,6 +5,9 @@
 #include <snrt.h>
 #include <stdint.h>
 
+
+void _mlir_ciface_simple_copy(OneDMemrefI32_t* memrefA, OneDMemrefI32_t* memrefB);
+
 int main() {
 
   // create memref object for A

Furthermore, it fails:

Warning: Failed to write binary name to logs/.rtlbinary
[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          0 to logs/trace_hart_00000000.dasm
[Tracer] Logging Hart          1 to logs/trace_hart_00000001.dasm
*** FAILED *** (tohost = 1)

Simple mult ✔️

Simple matmult ✔️

After applying this fix:

diff --git a/kernels/simple_matmul/main.c b/kernels/simple_matmul/main.c
index 1e37e3c..00c7789 100644
--- a/kernels/simple_matmul/main.c
+++ b/kernels/simple_matmul/main.c
@@ -49,7 +49,7 @@ void _mlir_ciface_simple_matmul_cpu(TwoDMemrefI8_t *a, TwoDMemrefI8_t *b,
   int8_t *a_ptr = a->aligned_data;
   int8_t *b_ptr = b->aligned_data;
   int32_t *c_ptr = c->aligned_data;
-  batch_gemm_cpu(Batch, M_param, K_param, N_param, a_ptr, b_ptr, c_ptr,
+  batch_gemm_cpu(Batch, M_param, K_param, N_param, a_ptr, b_ptr, 0, 0, c_ptr,
                  strideInnermostA, strideInnermostB, strideInnermostC, ldA, ldB,
                  ldC, strideA, strideB, strideC);
 }

Alloc ✔️

@jorendumoulin
Copy link
Contributor

I fixed the simple_copy kernel! See #54
I also fixed the xdsl thingy, see #53

@JosseVanDelm
Copy link
Contributor Author

Awaiting merging of #53

@JosseVanDelm JosseVanDelm force-pushed the Josse/add-upstream-llvm branch from 5462ae9 to 2020110 Compare January 8, 2024 10:44
latest update introduced offset fields for quantized gemm
@JosseVanDelm JosseVanDelm force-pushed the Josse/add-upstream-llvm branch from 2020110 to d9e7850 Compare January 8, 2024 11:10
@JosseVanDelm JosseVanDelm merged commit eaec056 into main Jan 8, 2024
3 of 4 checks passed
@JosseVanDelm JosseVanDelm deleted the Josse/add-upstream-llvm branch February 12, 2024 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking issue: Move to generic runtime
2 participants