MCPcopy Create free account
hub / github.com/NVIDIA/cuda-tile / writeProducerSection

Function writeProducerSection

lib/Bytecode/Writer/BytecodeWriter.cpp:1587–1614  ·  view source on GitHub ↗

===----------------------------------------------------------------------===// Producer Section ===----------------------------------------------------------------------===// producer-section =: producerStringIndex[varint] // Index into the string table Write the producer section to the bytecode file. This section is optional and contains producer information (e.g., compiler version, build optio

Source from the content-addressed store, hash-verified

1585/// version, build options) that identifies what tool generated this bytecode.
1586/// Only available in bytecode version 13.3+.
1587static LogicalResult writeProducerSection(raw_ostream &stream,
1588 cuda_tile::ModuleOp module,
1589 StringManager &strMgr,
1590 const BytecodeWriterConfig &config) {
1591 // Producer section is only available in version 13.3+.
1592 static const auto kMinProducerVersion =
1593 *BytecodeVersion::fromVersion(13, 3, 0);
1594 if (config.bytecodeVersion < kMinProducerVersion)
1595 return success();
1596
1597 auto producerAttr = module.getProducerAttr();
1598 if (!producerAttr)
1599 return success();
1600
1601 SmallVector<char> buffer;
1602 llvm::raw_svector_ostream sectionStream(buffer);
1603 EncodingWriter sectionWriter(sectionStream);
1604
1605 // Write the producer string index.
1606 sectionWriter.writeVarInt(strMgr.getStringIndex(producerAttr.getValue()));
1607
1608 // Write the section header and the buffered content to the main output
1609 // stream.
1610 writeSectionHeader(stream, Bytecode::Section::Producer, buffer.size(),
1611 /*alignment=*/1);
1612 stream.write(buffer.data(), buffer.size());
1613 return success();
1614}
1615
1616//===----------------------------------------------------------------------===//
1617// BytecodeWriter Implementation

Callers 1

writeBytecodeMethod · 0.85

Calls 5

writeSectionHeaderFunction · 0.85
writeVarIntMethod · 0.80
getStringIndexMethod · 0.80
sizeMethod · 0.80
writeMethod · 0.80

Tested by

no test coverage detected