MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / EmitTupleSelect

Function EmitTupleSelect

tensorflow/compiler/xla/service/llvm_ir/tuple_ops.cc:36–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void EmitTupleSelect(const IrArray& select, const IrArray& pred,
37 llvm::Value* on_true, llvm::Value* on_false,
38 llvm::IRBuilder<>* b) {
39 llvm::Module* module = getModuleFromBuilder(b);
40 CHECK(ShapeUtil::IsScalar(pred.GetShape()));
41
42 llvm::LoadInst* pred_value =
43 b->CreateLoad(pred.GetBasePointer(), "load_predicate_value");
44 llvm::Value* pred_cond = b->CreateICmpNE(
45 pred_value,
46 llvm::ConstantInt::get(PrimitiveTypeToIrType(PRED, module), 0),
47 "boolean_predicate");
48
49 VLOG(2) << "HandleSelect for tuple:";
50 VLOG(2) << " pred_value: " << DumpToString(*pred_value);
51 VLOG(2) << " pred_cond: " << DumpToString(*pred_cond);
52
53 llvm::Value* src = b->CreateSelect(pred_cond, on_true, on_false);
54 llvm::Value* dst = select.GetBasePointer();
55 int64 table_size = ShapeUtil::ByteSizeOfTupleIndexTable(
56 select.GetShape(), module->getDataLayout().getPointerSize());
57 b->CreateMemCpy(dst, /*DstAlign=*/1, src, /*SrcAlign=*/1,
58 b->getInt64(table_size));
59}
60
61void EmitTuple(const IrArray& tuple, absl::Span<llvm::Value* const> operands,
62 llvm::IRBuilder<>* b) {

Callers 2

HandleTupleSelectMethod · 0.85
HandleTupleSelectMethod · 0.85

Calls 7

getModuleFromBuilderFunction · 0.85
PrimitiveTypeToIrTypeFunction · 0.85
DumpToStringFunction · 0.85
IsScalarFunction · 0.50
getFunction · 0.50
GetShapeMethod · 0.45
GetBasePointerMethod · 0.45

Tested by

no test coverage detected