Skip to content

Commit

Permalink
Merge pull request #15 from ge0mk/gpu
Browse files Browse the repository at this point in the history
update cnm-to-gpu conversion
  • Loading branch information
ge0mk authored Sep 28, 2024
2 parents abba825 + cf2fda5 commit c1da17b
Show file tree
Hide file tree
Showing 7 changed files with 310 additions and 199 deletions.
9 changes: 9 additions & 0 deletions cinnamon/include/cinm-mlir/Conversion/CommonPatterns.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <llvm/ADT/ArrayRef.h>
#include <llvm/ADT/STLExtras.h>

#include <llvm/ADT/SmallVector.h>
#include <mlir/IR/AffineMap.h>
#include <mlir/IR/Builders.h>
#include <mlir/IR/Location.h>
#include <mlir/IR/OpDefinition.h>
Expand Down Expand Up @@ -37,4 +39,11 @@ struct ConvertCnmSetZeroToAffine : public OpConversionPattern<cnm::SetZeroOp> {
ConversionPatternRewriter &) const override;
};

SmallVector<Value> createAffineApply(OpBuilder &builder, Location loc,
AffineMap map, ValueRange values);

void createMemrefSubviewCopy(OpBuilder &builder, Location loc, Value src,
Value dst, ArrayRef<int64_t> sliceShape,
ValueRange srcOffsets, ValueRange dstOffsets);

} // namespace mlir
19 changes: 18 additions & 1 deletion cinnamon/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,28 @@ cinm-opt-help: (cinm-opt "--help")
debug-cinm-opt *ARGS:
gdb --args {{build_dir}}/bin/cinm-opt {{ARGS}}

cinm-to-cnm FILE *ARGS: (
cinm-opt FILE
"--cinm-tiling"
"--affine-loop-unroll='unroll-full unroll-full-threshold=1'"
"--convert-cinm-to-cnm"
"--lower-affine"
"--one-shot-bufferize='bufferize-function-boundaries function-boundary-type-conversion=identity-layout-map'"
"--convert-linalg-to-affine-loops"
"--lower-affine"
"--buffer-loop-hoisting"
"--buffer-hoisting"
"--cse"
ARGS
)

cnm-to-gpu FILE *ARGS: (cinm-opt FILE "--convert-cnm-to-gpu" ARGS)
cinm-to-gpu FILE *ARGS: (cinm-to-cnm FILE "--convert-cnm-to-gpu" ARGS)

cinm-vulkan-runner FILE *ARGS:
{{build_dir}}/bin/cinm-vulkan-runner {{FILE}} \
--shared-libs=../llvm-project/build/lib/libvulkan-runtime-wrappers.so,../llvm-project/build/lib/libmlir_runner_utils.so.17 \
--shared-libs={{llvm_prefix}}/lib/libvulkan-runtime-wrappers.so,{{llvm_prefix}}/lib/libmlir_runner_utils.so \
--entry-point-result=void \
{{ARGS}}

genBench NAME: (doNinja "cinm-opt")
Expand Down
Loading

0 comments on commit c1da17b

Please sign in to comment.