cbalint13 commented on code in PR #16347:
URL: https://github.com/apache/tvm/pull/16347#discussion_r1441740282
##########
src/target/llvm/codegen_llvm.cc:
##########
@@ -1851,7 +1867,29 @@ llvm::Value* CodeGenLLVM::VisitExpr_(const ShuffleNode*
op) {
}
llvm::Value* CodeGenLLVM::VisitExpr_(const BroadcastNode* op) {
- return CreateBroadcast(MakeValue(op->value), op->lanes);
+ DataType dtype = op->dtype;
+ llvm::Value* value = MakeValue(op->value);
+ llvm::Type* type = DTypeToLLVMType(dtype);
+ llvm::ElementCount ec;
+ if (dtype.is_scalable()) {
+ ec = llvm::ElementCount::get(dtype.lanes(), true);
+ } else {
+ ec = llvm::ElementCount::get(dtype.lanes(), false);
+ }
+ llvm::Constant* undef = llvm::UndefValue::get(type);
+ llvm::Constant* zero = ConstInt32(0);
+ value = builder_->CreateInsertElement(undef, value, zero);
+#if TVM_LLVM_VERSION >= 120
+ llvm::Constant* mask = llvm::ConstantVector::getSplat(ec, zero);
+#elif TVM_LLVM_VERSION >= 110
+ llvm::Constant* mask = llvm::ConstantVector::getSplat(ec, zero);
Review Comment:
* Can be merged to single ```TVM_LLVM_VERSION >= 110```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]