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 TMA support for circular buffering pass #2833

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
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
17 changes: 13 additions & 4 deletions csrc/device_lower/pass/allocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,10 +483,19 @@ class AllocationInserter : public kir::ExprMutator {
.build();
mbarrier->setMemoryType(MemoryType::Shared);

// The wait condition for mbarrier is a single thread and the expected
// number of transaction bytes
kir::MBarrierInit* mbarrier_init = IrBuilder::create<kir::MBarrierInit>(
mbarrier, expr->container()->oneVal(DataType::UInt32));
// Get all threads in CTA
NamedScalar* bdimx = NamedScalar::getParallelDim(ParallelType::TIDx);
NamedScalar* bdimy = NamedScalar::getParallelDim(ParallelType::TIDy);
NamedScalar* bdimz = NamedScalar::getParallelDim(ParallelType::TIDz);
Val* all_threads_in_cta = SimplifyingIrBuilder::mulExpr(
bdimx, SimplifyingIrBuilder::mulExpr(bdimy, bdimz));
all_threads_in_cta = SimplifyingIrBuilder::maybeCastExpr(
DataType::UInt32, all_threads_in_cta);

// The wait condition for mbarrier is a all participating threads in CTA
// and the expected number of transaction bytes
kir::MBarrierInit* mbarrier_init =
IrBuilder::create<kir::MBarrierInit>(mbarrier, all_threads_in_cta);

kir::Allocate* mbarrier_alloc =
IrBuilder::create<kir::Allocate>(mbarrier, MemoryType::Shared);
Expand Down
Loading
Loading