Skip to content
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
4 changes: 3 additions & 1 deletion lib/Conversion/ForthToMemRef/ForthToMemRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/NVVMDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/PatternMatch.h"
Expand All @@ -28,8 +29,9 @@ namespace {

// Stack configuration constants
constexpr int64_t kStackSize = 256;
// NVPTX shared memory address space for LLVM ptr types.
constexpr unsigned kWorkgroupAddressSpace =
static_cast<unsigned>(gpu::AddressSpace::Workgroup);
static_cast<unsigned>(NVVM::kSharedMemorySpace);

/// Type converter for forth.stack -> memref + index
class ForthToMemRefTypeConverter : public TypeConverter {
Expand Down
8 changes: 4 additions & 4 deletions test/Conversion/ForthToMemRef/memory-ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
// CHECK: llvm.store %{{.*}}, %{{.*}} : i64, !llvm.ptr

// shared load (S@): pop address, inttoptr shared addrspace, llvm.load
// CHECK: llvm.inttoptr %{{.*}} : i64 to !llvm.ptr<{{[1-9][0-9]*}}>
// CHECK: llvm.load %{{.*}} : !llvm.ptr<{{[1-9][0-9]*}}> -> i64
// CHECK: llvm.inttoptr %{{.*}} : i64 to !llvm.ptr<3>
// CHECK: llvm.load %{{.*}} : !llvm.ptr<3> -> i64

// shared store (S!): pop address + value, inttoptr shared addrspace, llvm.store
// CHECK: llvm.inttoptr %{{.*}} : i64 to !llvm.ptr<{{[1-9][0-9]*}}>
// CHECK: llvm.store %{{.*}}, %{{.*}} : i64, !llvm.ptr<{{[1-9][0-9]*}}>
// CHECK: llvm.inttoptr %{{.*}} : i64 to !llvm.ptr<3>
// CHECK: llvm.store %{{.*}}, %{{.*}} : i64, !llvm.ptr<3>

module {
func.func private @main() {
Expand Down