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

Snakemake: Add simple_copy kernel #312

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-run-kernel-snake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
working-directory: kernels/${{ matrix.kernel }}
strategy:
matrix:
kernel: [alloc, transform_copy]
kernel: [alloc, simple_copy, transform_copy]
2 changes: 1 addition & 1 deletion .github/workflows/build-run-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
working-directory: kernels/${{ matrix.kernel }}
strategy:
matrix:
kernel: [simple_copy, streamer_alu, tiled_add, streamer_matmul, gemmini, rescale, gemm]
kernel: [streamer_alu, tiled_add, streamer_matmul, gemmini, rescale, gemm]
33 changes: 0 additions & 33 deletions kernels/simple_copy/Makefile

This file was deleted.

69 changes: 69 additions & 0 deletions kernels/simple_copy/Snakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from util.snake.configs import get_snax_mac_config

config = get_snax_mac_config()
config["snaxoptflags"] = ",".join(
[
"dispatch-kernels",
"set-memory-space",
"set-memory-layout",
"realize-memref-casts",
"reuse-memref-allocs",
"insert-sync-barrier",
"dispatch-regions",
"linalg-to-library-call",
"snax-copy-to-dma",
"memref-to-snax",
"snax-to-func",
"clear-memory-space",
]
)


module default_rules:
snakefile:
"../../util/snake/default_rules.smk"
config:
config


use rule * from default_rules as default_*


# Rules
rule all:
input:
"simple_copy.x",
shell:
"{config[vltsim]} {input[0]}"


rule compile_main:
input:
"main.c",
"data.h",
output:
"main.o",
shell:
"{config[cc]} {config[cflags]} -c {input[0]}"


rule link_snax_binary:
input:
"simple_copy.o",
"main.o",
"data.o",
output:
"simple_copy.x",
shell:
"{config[ld]} {config[ldflags]} {input} -o {output}"


from gendata import create_data_files


rule generate_data:
output:
"data.c",
"data.h",
run:
create_data_files()
5 changes: 2 additions & 3 deletions kernels/simple_copy/gendata.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# simple script to generate inputs and expected outputs for simple_mult

import numpy as np

from util.gendata import create_data, create_header

if __name__ == "__main__":

def create_data_files():
array_size = 10
A = np.linspace(1, array_size, array_size, dtype=np.int32)
sizes = {"N": array_size}
Expand Down
Loading