feat: Add ascend backend#168
Open
weilinquan wants to merge 1 commit into
Open
Conversation
janssen-v
reviewed
Apr 24, 2026
Comment on lines
+269
to
+273
| def synchronized_print(message, rank, world_size): | ||
| """Print message with rank prefix, synchronized across all ranks""" | ||
| dist.barrier() # Ensure all ranks reach here before any printing | ||
| print(f"[Rank {rank:02d}/{world_size:02d}] {message}", flush=True) | ||
| dist.barrier() # Ensure all ranks finish printing before continuing |
There was a problem hiding this comment.
Dead code, sorry forgot to remove this 😅
janssen-v
reviewed
Apr 24, 2026
Comment on lines
+146
to
+147
| if (ASCEND::pipeMap.contains(llvm::StringRef(customName))) { | ||
| customOp.setPipe(ASCEND::pipeMap.at(llvm::StringRef(customName))); |
There was a problem hiding this comment.
Here, we are doing lookup twice. You can use the find method and reuse the value to setPipe.
janssen-v
reviewed
Apr 24, 2026
Comment on lines
+89
to
+99
| if (auto intTy = llvm::dyn_cast<IntegerType>(type)) { | ||
| if (intTy.getWidth() == 8) { | ||
| return "int8"; | ||
| } else if (intTy.getWidth() == 16) { | ||
| return "int16"; | ||
| } else if (intTy.getWidth() == 32) { | ||
| return "int32"; | ||
| } else if (intTy.getWidth() == 64) { | ||
| return "int64"; | ||
| } | ||
| } |
There was a problem hiding this comment.
You can getWidth() once and switch on the width
janssen-v
reviewed
Apr 24, 2026
Comment on lines
+112
to
+125
| if (std::is_same_v<DistOp, distributed::SymmAtOp> || | ||
| symbolName == "aclshmem_ptr") { | ||
| auto elemTy = llvm::cast<triton::PointerType>(op->getOperand(0).getType()) | ||
| .getPointeeType(); | ||
| symbolName = "aclshmem_" + getTypeName(elemTy) + "_ptr"; | ||
| } else if constexpr (std::is_same_v<DistOp, distributed::GetRankOp>) { | ||
| symbolName = "aclshmem_my_pe"; | ||
| } else if constexpr (std::is_same_v<DistOp, distributed::GetNumRanksOp>) { | ||
| symbolName = "aclshmem_n_pes"; | ||
| } else if constexpr (std::is_same_v<DistOp, distributed::NotifyOp>) { | ||
| auto notifyOp = llvm::cast<distributed::NotifyOp>(op); | ||
| auto typeName = getTypeName(notifyOp.getSignalVal().getType()); | ||
| symbolName = "aclshmem_" + typeName + "_p"; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary