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

Add MemoryType::Tensor #3780

Merged
merged 1 commit into from
Jan 29, 2025
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
7 changes: 6 additions & 1 deletion csrc/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3183,7 +3183,12 @@ class CudaKernelGenerator : private kir::ConstIrVisitor {
if (va.find(tv) != va.end()) {
aligned_array_of_regs_.insert(tv);
}
} break;
break;
}
case MemoryType::Tensor: {
NVF_THROW("Not implemented yet");
break;
}
default:
NVF_THROW("Unexpected memory type");
}
Expand Down
4 changes: 3 additions & 1 deletion csrc/ir/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ inline bool isMemoryPartitionedAcross(
return isParallelTypeThread(parallel_type) ||
isParallelTypeDeviceDim(parallel_type);
case MemoryType::Shared:
case MemoryType::Tensor:
return isParallelTypeBlockDim(parallel_type) ||
isParallelTypeDeviceDim(parallel_type);
case MemoryType::Global:
Expand All @@ -732,7 +733,8 @@ inline bool isMemorySharedAcross(
// Nothing is shared if it's Local
return false;
case MemoryType::Shared:
// Only TID parallelized domains are shared if it's Shared
case MemoryType::Tensor:
// Only TID parallelized domains are shared if it's Shared or Tensor
return isParallelTypeThreadDim(parallel_type);
case MemoryType::Global:
// Only TID and BID parallelized domains are shared if it's Global
Expand Down
2 changes: 2 additions & 0 deletions csrc/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class KernelIrScanner : private IrVisitor {
summary_.dynamic_lmem_allocations.emplace_back(allocate);
}
break;
case MemoryType::Tensor:
break;
default:
NVF_THROW("Unknown memory type to allocate.");
}
Expand Down
3 changes: 3 additions & 0 deletions csrc/tensor_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ std::string TensorView::toString(int indent_size) const {
case MemoryType::Local:
ss << "_l";
break;
case MemoryType::Tensor:
ss << "_t";
break;
default:
NVF_THROW("Unknown tensor memory type.");
}
Expand Down
2 changes: 2 additions & 0 deletions csrc/type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,8 @@ static const char* memory_type2string(MemoryType t) {
return "shared";
case MemoryType::Global:
return "global";
case MemoryType::Tensor:
return "tensor";
default:
NVF_THROW("Unexpected MemoryType");
}
Expand Down
2 changes: 1 addition & 1 deletion csrc/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ static constexpr std::array<ParallelType, 3> kParallelTypeTIDs = {
static constexpr std::array<ParallelType, 1> kParallelTypeDIDs = {
ParallelType::DIDx};

enum class MemoryType { Local, Shared, Global };
enum class MemoryType { Local, Shared, Global, Tensor };

// Symbolic: Undetermined between Iteration or Broadcast
enum class IterType {
Expand Down