MCPcopy Create free account
hub / github.com/KhronosGroup/glslang / makeFloatE5M2Type

Method makeFloatE5M2Type

SPIRV/SpvBuilder.cpp:361–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359}
360
361Id Builder::makeFloatE5M2Type()
362{
363 // try to find it
364 Instruction* type;
365 for (int t = 0; t < (int)groupedTypes[enumCast(Op::OpTypeFloat)].size(); ++t) {
366 type = groupedTypes[enumCast(Op::OpTypeFloat)][t];
367 if (type->getNumOperands() != 2) {
368 continue;
369 }
370 if (type->getImmediateOperand(0) == (unsigned)8 &&
371 type->getImmediateOperand(1) == FPEncoding::Float8E5M2EXT)
372 return type->getResultId();
373 }
374
375 // not found, make it
376 type = new Instruction(getUniqueId(), NoType, Op::OpTypeFloat);
377 type->addImmediateOperand(8);
378 type->addImmediateOperand(FPEncoding::Float8E5M2EXT);
379 groupedTypes[enumCast(Op::OpTypeFloat)].push_back(type);
380 constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
381 module.mapInstruction(type);
382
383 addExtension(spv::E_SPV_EXT_float8);
384 addCapability(Capability::Float8EXT);
385
386 if (emitNonSemanticShaderDebugInfo) {
387 auto const debugResultId = makeFloatDebugType(8, makeUintConstant((unsigned)FPEncoding::Float8E5M2EXT));
388 debugTypeIdLookup[type->getResultId()] = debugResultId;
389 }
390
391 return type->getResultId();
392}
393
394Id Builder::makeFloatE4M3Type()
395{

Callers 1

Calls 8

enumCastFunction · 0.85
getNumOperandsMethod · 0.80
getImmediateOperandMethod · 0.80
getResultIdMethod · 0.80
addImmediateOperandMethod · 0.80
mapInstructionMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected