Fix various source comment (doxygen) typos (#4680)
Found via `codespell -q 3 -L fo,lod,parm
This commit is contained in:
Родитель
ff91b1c275
Коммит
65ecfd1093
|
@ -560,7 +560,7 @@ SPIRV_TOOLS_EXPORT bool spvParseVulkanEnv(uint32_t vulkan_ver,
|
||||||
// Creates a context object for most of the SPIRV-Tools API.
|
// Creates a context object for most of the SPIRV-Tools API.
|
||||||
// Returns null if env is invalid.
|
// Returns null if env is invalid.
|
||||||
//
|
//
|
||||||
// See specific API calls for how the target environment is interpeted
|
// See specific API calls for how the target environment is interpreted
|
||||||
// (particularly assembly and validation).
|
// (particularly assembly and validation).
|
||||||
SPIRV_TOOLS_EXPORT spv_context spvContextCreate(spv_target_env env);
|
SPIRV_TOOLS_EXPORT spv_context spvContextCreate(spv_target_env env);
|
||||||
|
|
||||||
|
@ -612,7 +612,7 @@ SPIRV_TOOLS_EXPORT void spvValidatorOptionsSetRelaxLogicalPointer(
|
||||||
// set that option.
|
// set that option.
|
||||||
// 2) Pointers that are pass as parameters to function calls do not have to
|
// 2) Pointers that are pass as parameters to function calls do not have to
|
||||||
// match the storage class of the formal parameter.
|
// match the storage class of the formal parameter.
|
||||||
// 3) Pointers that are actaul parameters on function calls do not have to point
|
// 3) Pointers that are actual parameters on function calls do not have to point
|
||||||
// to the same type pointed as the formal parameter. The types just need to
|
// to the same type pointed as the formal parameter. The types just need to
|
||||||
// logically match.
|
// logically match.
|
||||||
// 4) GLSLstd450 Interpolate* instructions can have a load of an interpolant
|
// 4) GLSLstd450 Interpolate* instructions can have a load of an interpolant
|
||||||
|
@ -638,7 +638,7 @@ SPIRV_TOOLS_EXPORT void spvValidatorOptionsSetUniformBufferStandardLayout(
|
||||||
// Records whether the validator should use "scalar" block layout rules.
|
// Records whether the validator should use "scalar" block layout rules.
|
||||||
// Scalar layout rules are more permissive than relaxed block layout.
|
// Scalar layout rules are more permissive than relaxed block layout.
|
||||||
//
|
//
|
||||||
// See Vulkan extnesion VK_EXT_scalar_block_layout. The scalar alignment is
|
// See Vulkan extension VK_EXT_scalar_block_layout. The scalar alignment is
|
||||||
// defined as follows:
|
// defined as follows:
|
||||||
// - scalar alignment of a scalar is the scalar size
|
// - scalar alignment of a scalar is the scalar size
|
||||||
// - scalar alignment of a vector is the scalar alignment of its component
|
// - scalar alignment of a vector is the scalar alignment of its component
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Context {
|
||||||
public:
|
public:
|
||||||
// Constructs a context targeting the given environment |env|.
|
// Constructs a context targeting the given environment |env|.
|
||||||
//
|
//
|
||||||
// See specific API calls for how the target environment is interpeted
|
// See specific API calls for how the target environment is interpreted
|
||||||
// (particularly assembly and validation).
|
// (particularly assembly and validation).
|
||||||
//
|
//
|
||||||
// The constructed instance will have an empty message consumer, which just
|
// The constructed instance will have an empty message consumer, which just
|
||||||
|
@ -139,7 +139,7 @@ class ValidatorOptions {
|
||||||
// set that option.
|
// set that option.
|
||||||
// 2) Pointers that are pass as parameters to function calls do not have to
|
// 2) Pointers that are pass as parameters to function calls do not have to
|
||||||
// match the storage class of the formal parameter.
|
// match the storage class of the formal parameter.
|
||||||
// 3) Pointers that are actaul parameters on function calls do not have to
|
// 3) Pointers that are actual parameters on function calls do not have to
|
||||||
// point to the same type pointed as the formal parameter. The types just
|
// point to the same type pointed as the formal parameter. The types just
|
||||||
// need to logically match.
|
// need to logically match.
|
||||||
// 4) GLSLstd450 Interpolate* instructions can have a load of an interpolant
|
// 4) GLSLstd450 Interpolate* instructions can have a load of an interpolant
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Optimizer {
|
||||||
// consumed by the RegisterPass() method. Tokens are one-time objects that
|
// consumed by the RegisterPass() method. Tokens are one-time objects that
|
||||||
// only support move; copying is not allowed.
|
// only support move; copying is not allowed.
|
||||||
struct PassToken {
|
struct PassToken {
|
||||||
struct Impl; // Opaque struct for holding inernal data.
|
struct Impl; // Opaque struct for holding internal data.
|
||||||
|
|
||||||
PassToken(std::unique_ptr<Impl>);
|
PassToken(std::unique_ptr<Impl>);
|
||||||
|
|
||||||
|
@ -296,11 +296,11 @@ Optimizer::PassToken CreateFreezeSpecConstantValuePass();
|
||||||
// and can be changed in future. A spec constant is foldable if all of its
|
// and can be changed in future. A spec constant is foldable if all of its
|
||||||
// value(s) can be determined from the module. E.g., an integer spec constant
|
// value(s) can be determined from the module. E.g., an integer spec constant
|
||||||
// defined with OpSpecConstantOp instruction can be folded if its value won't
|
// defined with OpSpecConstantOp instruction can be folded if its value won't
|
||||||
// change later. This pass will replace the original OpSpecContantOp instruction
|
// change later. This pass will replace the original OpSpecConstantOp
|
||||||
// with an OpConstant instruction. When folding composite spec constants,
|
// instruction with an OpConstant instruction. When folding composite spec
|
||||||
// new instructions may be inserted to define the components of the composite
|
// constants, new instructions may be inserted to define the components of the
|
||||||
// constant first, then the original spec constants will be replaced by
|
// composite constant first, then the original spec constants will be replaced
|
||||||
// OpConstantComposite instructions.
|
// by OpConstantComposite instructions.
|
||||||
//
|
//
|
||||||
// There are some operations not supported yet:
|
// There are some operations not supported yet:
|
||||||
// OpSConvert, OpFConvert, OpQuantizeToF16 and
|
// OpSConvert, OpFConvert, OpQuantizeToF16 and
|
||||||
|
@ -326,7 +326,7 @@ Optimizer::PassToken CreateUnifyConstantPass();
|
||||||
|
|
||||||
// Creates a eliminate-dead-constant pass.
|
// Creates a eliminate-dead-constant pass.
|
||||||
// A eliminate-dead-constant pass removes dead constants, including normal
|
// A eliminate-dead-constant pass removes dead constants, including normal
|
||||||
// contants defined by OpConstant, OpConstantComposite, OpConstantTrue, or
|
// constants defined by OpConstant, OpConstantComposite, OpConstantTrue, or
|
||||||
// OpConstantFalse and spec constants defined by OpSpecConstant,
|
// OpConstantFalse and spec constants defined by OpSpecConstant,
|
||||||
// OpSpecConstantComposite, OpSpecConstantTrue, OpSpecConstantFalse or
|
// OpSpecConstantComposite, OpSpecConstantTrue, OpSpecConstantFalse or
|
||||||
// OpSpecConstantOp.
|
// OpSpecConstantOp.
|
||||||
|
@ -390,7 +390,7 @@ Optimizer::PassToken CreateInlineOpaquePass();
|
||||||
// Only modules with relaxed logical addressing (see opt/instruction.h) are
|
// Only modules with relaxed logical addressing (see opt/instruction.h) are
|
||||||
// currently processed.
|
// currently processed.
|
||||||
//
|
//
|
||||||
// This pass is most effective if preceeded by Inlining and
|
// This pass is most effective if preceded by Inlining and
|
||||||
// LocalAccessChainConvert. This pass will reduce the work needed to be done
|
// LocalAccessChainConvert. This pass will reduce the work needed to be done
|
||||||
// by LocalSingleStoreElim and LocalMultiStoreElim.
|
// by LocalSingleStoreElim and LocalMultiStoreElim.
|
||||||
//
|
//
|
||||||
|
@ -408,7 +408,7 @@ Optimizer::PassToken CreateLocalSingleBlockLoadStoreElimPass();
|
||||||
// Note that some branches and blocks may be left to avoid creating invalid
|
// Note that some branches and blocks may be left to avoid creating invalid
|
||||||
// control flow. Improving this is left to future work.
|
// control flow. Improving this is left to future work.
|
||||||
//
|
//
|
||||||
// This pass is most effective when preceeded by passes which eliminate
|
// This pass is most effective when preceded by passes which eliminate
|
||||||
// local loads and stores, effectively propagating constant values where
|
// local loads and stores, effectively propagating constant values where
|
||||||
// possible.
|
// possible.
|
||||||
Optimizer::PassToken CreateDeadBranchElimPass();
|
Optimizer::PassToken CreateDeadBranchElimPass();
|
||||||
|
@ -425,7 +425,7 @@ Optimizer::PassToken CreateDeadBranchElimPass();
|
||||||
// are currently processed. Currently modules with any extensions enabled are
|
// are currently processed. Currently modules with any extensions enabled are
|
||||||
// not processed. This is left for future work.
|
// not processed. This is left for future work.
|
||||||
//
|
//
|
||||||
// This pass is most effective if preceeded by Inlining and
|
// This pass is most effective if preceded by Inlining and
|
||||||
// LocalAccessChainConvert. LocalSingleStoreElim and LocalSingleBlockElim
|
// LocalAccessChainConvert. LocalSingleStoreElim and LocalSingleBlockElim
|
||||||
// will reduce the work that this pass has to do.
|
// will reduce the work that this pass has to do.
|
||||||
Optimizer::PassToken CreateLocalMultiStoreElimPass();
|
Optimizer::PassToken CreateLocalMultiStoreElimPass();
|
||||||
|
@ -630,7 +630,7 @@ Optimizer::PassToken CreateRedundancyEliminationPass();
|
||||||
Optimizer::PassToken CreateScalarReplacementPass(uint32_t size_limit = 100);
|
Optimizer::PassToken CreateScalarReplacementPass(uint32_t size_limit = 100);
|
||||||
|
|
||||||
// Create a private to local pass.
|
// Create a private to local pass.
|
||||||
// This pass looks for variables delcared in the private storage class that are
|
// This pass looks for variables declared in the private storage class that are
|
||||||
// used in only one function. Those variables are moved to the function storage
|
// used in only one function. Those variables are moved to the function storage
|
||||||
// class in the function that they are used.
|
// class in the function that they are used.
|
||||||
Optimizer::PassToken CreatePrivateToLocalPass();
|
Optimizer::PassToken CreatePrivateToLocalPass();
|
||||||
|
|
|
@ -215,7 +215,7 @@ class Parser {
|
||||||
size_t word_index; // The current position in words.
|
size_t word_index; // The current position in words.
|
||||||
size_t instruction_count; // The count of processed instructions
|
size_t instruction_count; // The count of processed instructions
|
||||||
spv_endianness_t endian; // The endianness of the binary.
|
spv_endianness_t endian; // The endianness of the binary.
|
||||||
// Is the SPIR-V binary in a different endiannes from the host native
|
// Is the SPIR-V binary in a different endianness from the host native
|
||||||
// endianness?
|
// endianness?
|
||||||
bool requires_endian_conversion;
|
bool requires_endian_conversion;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ bool spvExtInstIsNonSemantic(const spv_ext_inst_type_t type);
|
||||||
// Returns true if the extended instruction set is debug info
|
// Returns true if the extended instruction set is debug info
|
||||||
bool spvExtInstIsDebugInfo(const spv_ext_inst_type_t type);
|
bool spvExtInstIsDebugInfo(const spv_ext_inst_type_t type);
|
||||||
|
|
||||||
// Finds the named extented instruction of the given type in the given extended
|
// Finds the named extended instruction of the given type in the given extended
|
||||||
// instruction table. On success, returns SPV_SUCCESS and writes a handle of
|
// instruction table. On success, returns SPV_SUCCESS and writes a handle of
|
||||||
// the instruction entry into *entry.
|
// the instruction entry into *entry.
|
||||||
spv_result_t spvExtInstTableNameLookup(const spv_ext_inst_table table,
|
spv_result_t spvExtInstTableNameLookup(const spv_ext_inst_table table,
|
||||||
|
@ -35,7 +35,7 @@ spv_result_t spvExtInstTableNameLookup(const spv_ext_inst_table table,
|
||||||
const char* name,
|
const char* name,
|
||||||
spv_ext_inst_desc* entry);
|
spv_ext_inst_desc* entry);
|
||||||
|
|
||||||
// Finds the extented instruction of the given type in the given extended
|
// Finds the extended instruction of the given type in the given extended
|
||||||
// instruction table by value. On success, returns SPV_SUCCESS and writes a
|
// instruction table by value. On success, returns SPV_SUCCESS and writes a
|
||||||
// handle of the instruction entry into *entry.
|
// handle of the instruction entry into *entry.
|
||||||
spv_result_t spvExtInstTableValueLookup(const spv_ext_inst_table table,
|
spv_result_t spvExtInstTableValueLookup(const spv_ext_inst_table table,
|
||||||
|
|
|
@ -163,7 +163,7 @@ class FactManager {
|
||||||
std::vector<const protobufs::DataDescriptor*> GetSynonymsForDataDescriptor(
|
std::vector<const protobufs::DataDescriptor*> GetSynonymsForDataDescriptor(
|
||||||
const protobufs::DataDescriptor& data_descriptor) const;
|
const protobufs::DataDescriptor& data_descriptor) const;
|
||||||
|
|
||||||
// Returns true if and ony if |data_descriptor1| and |data_descriptor2| are
|
// Returns true if and only if |data_descriptor1| and |data_descriptor2| are
|
||||||
// known to be synonymous.
|
// known to be synonymous.
|
||||||
bool IsSynonymous(const protobufs::DataDescriptor& data_descriptor1,
|
bool IsSynonymous(const protobufs::DataDescriptor& data_descriptor1,
|
||||||
const protobufs::DataDescriptor& data_descriptor2) const;
|
const protobufs::DataDescriptor& data_descriptor2) const;
|
||||||
|
@ -174,7 +174,7 @@ class FactManager {
|
||||||
//==============================
|
//==============================
|
||||||
// Querying facts about dead blocks
|
// Querying facts about dead blocks
|
||||||
|
|
||||||
// Returns true if and ony if |block_id| is the id of a block known to be
|
// Returns true if and only if |block_id| is the id of a block known to be
|
||||||
// dynamically unreachable.
|
// dynamically unreachable.
|
||||||
bool BlockIsDead(uint32_t block_id) const;
|
bool BlockIsDead(uint32_t block_id) const;
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ class FactManager {
|
||||||
//==============================
|
//==============================
|
||||||
// Querying facts about livesafe function
|
// Querying facts about livesafe function
|
||||||
|
|
||||||
// Returns true if and ony if |function_id| is the id of a function known
|
// Returns true if and only if |function_id| is the id of a function known
|
||||||
// to be livesafe.
|
// to be livesafe.
|
||||||
bool FunctionIsLivesafe(uint32_t function_id) const;
|
bool FunctionIsLivesafe(uint32_t function_id) const;
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ class FactManager {
|
||||||
//==============================
|
//==============================
|
||||||
// Querying facts about irrelevant values
|
// Querying facts about irrelevant values
|
||||||
|
|
||||||
// Returns true if and ony if the value of the pointee associated with
|
// Returns true if and only if the value of the pointee associated with
|
||||||
// |pointer_id| is irrelevant.
|
// |pointer_id| is irrelevant.
|
||||||
bool PointeeValueIsIrrelevant(uint32_t pointer_id) const;
|
bool PointeeValueIsIrrelevant(uint32_t pointer_id) const;
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ uint32_t FuzzerPass::FindOrCreateFloatType(uint32_t width) {
|
||||||
|
|
||||||
uint32_t FuzzerPass::FindOrCreateFunctionType(
|
uint32_t FuzzerPass::FindOrCreateFunctionType(
|
||||||
uint32_t return_type_id, const std::vector<uint32_t>& argument_id) {
|
uint32_t return_type_id, const std::vector<uint32_t>& argument_id) {
|
||||||
// FindFunctionType has a sigle argument for OpTypeFunction operands
|
// FindFunctionType has a single argument for OpTypeFunction operands
|
||||||
// so we will have to copy them all in this vector
|
// so we will have to copy them all in this vector
|
||||||
std::vector<uint32_t> type_ids(argument_id.size() + 1);
|
std::vector<uint32_t> type_ids(argument_id.size() + 1);
|
||||||
type_ids[0] = return_type_id;
|
type_ids[0] = return_type_id;
|
||||||
|
|
|
@ -479,7 +479,7 @@ void FuzzerPassDonateModules::HandleTypeOrValue(
|
||||||
"should have been donated.");
|
"should have been donated.");
|
||||||
|
|
||||||
// It is OK to have duplicate constant composite definitions, so add
|
// It is OK to have duplicate constant composite definitions, so add
|
||||||
// this to the module using remapped versions of all consituent ids and
|
// this to the module using remapped versions of all constituent ids and
|
||||||
// the result type.
|
// the result type.
|
||||||
new_result_id = GetFuzzerContext()->GetFreshId();
|
new_result_id = GetFuzzerContext()->GetFreshId();
|
||||||
std::vector<uint32_t> constituent_ids;
|
std::vector<uint32_t> constituent_ids;
|
||||||
|
|
|
@ -1961,10 +1961,10 @@ message TransformationReplaceBooleanConstantWithConstantBinary {
|
||||||
// A descriptor for the boolean constant id we would like to replace
|
// A descriptor for the boolean constant id we would like to replace
|
||||||
IdUseDescriptor id_use_descriptor = 1;
|
IdUseDescriptor id_use_descriptor = 1;
|
||||||
|
|
||||||
// Id for the constant to be used on the LHS of the comparision
|
// Id for the constant to be used on the LHS of the comparison
|
||||||
uint32 lhs_id = 2;
|
uint32 lhs_id = 2;
|
||||||
|
|
||||||
// Id for the constant to be used on the RHS of the comparision
|
// Id for the constant to be used on the RHS of the comparison
|
||||||
uint32 rhs_id = 3;
|
uint32 rhs_id = 3;
|
||||||
|
|
||||||
// Opcode for binary operator
|
// Opcode for binary operator
|
||||||
|
@ -2403,7 +2403,7 @@ message TransformationWrapVectorSynonym {
|
||||||
// va = vector(..., a, ...)
|
// va = vector(..., a, ...)
|
||||||
// vb = vector(..., b, ...)
|
// vb = vector(..., b, ...)
|
||||||
//
|
//
|
||||||
// where a and b are in the same position i in each of their correponding vector
|
// where a and b are in the same position i in each of their corresponding vector
|
||||||
// and a is synonymous with va[i] and b is synonymous with vb[i].
|
// and a is synonymous with va[i] and b is synonymous with vb[i].
|
||||||
//
|
//
|
||||||
// The transformation then add an instruction vc = va op vb where c is synonymous
|
// The transformation then add an instruction vc = va op vb where c is synonymous
|
||||||
|
|
|
@ -75,7 +75,7 @@ bool TransformationAddConstantComposite::IsApplicable(
|
||||||
// We do not create constants of structs decorated with Block nor
|
// We do not create constants of structs decorated with Block nor
|
||||||
// BufferBlock. The SPIR-V spec does not explicitly disallow this, but it
|
// BufferBlock. The SPIR-V spec does not explicitly disallow this, but it
|
||||||
// seems like a strange thing to do, so we disallow it to avoid triggering
|
// seems like a strange thing to do, so we disallow it to avoid triggering
|
||||||
// low priorty edge case issues related to it.
|
// low priority edge case issues related to it.
|
||||||
if (fuzzerutil::HasBlockOrBufferBlockDecoration(
|
if (fuzzerutil::HasBlockOrBufferBlockDecoration(
|
||||||
ir_context, composite_type_instruction->result_id())) {
|
ir_context, composite_type_instruction->result_id())) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -325,7 +325,7 @@ void TransformationDuplicateRegionWithSelection::Apply(
|
||||||
std::map<uint32_t, uint32_t> original_id_to_phi_id =
|
std::map<uint32_t, uint32_t> original_id_to_phi_id =
|
||||||
fuzzerutil::RepeatedUInt32PairToMap(message_.original_id_to_phi_id());
|
fuzzerutil::RepeatedUInt32PairToMap(message_.original_id_to_phi_id());
|
||||||
|
|
||||||
// Use oveflow ids to fill in any required ids that are missing from these
|
// Use overflow ids to fill in any required ids that are missing from these
|
||||||
// maps.
|
// maps.
|
||||||
for (auto block : region_blocks) {
|
for (auto block : region_blocks) {
|
||||||
if (original_label_to_duplicate_label.count(block->id()) == 0) {
|
if (original_label_to_duplicate_label.count(block->id()) == 0) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ class TransformationReplaceIdWithSynonym : public Transformation {
|
||||||
protobufs::IdUseDescriptor id_use_descriptor, uint32_t synonymous_id);
|
protobufs::IdUseDescriptor id_use_descriptor, uint32_t synonymous_id);
|
||||||
|
|
||||||
// - The fact manager must know that the id identified by
|
// - The fact manager must know that the id identified by
|
||||||
// |message_.id_use_descriptor| is synonomous with |message_.synonymous_id|.
|
// |message_.id_use_descriptor| is synonymous with |message_.synonymous_id|.
|
||||||
// - Replacing the id in |message_.id_use_descriptor| by
|
// - Replacing the id in |message_.id_use_descriptor| by
|
||||||
// |message_.synonymous_id| must respect SPIR-V's rules about uses being
|
// |message_.synonymous_id| must respect SPIR-V's rules about uses being
|
||||||
// dominated by their definitions.
|
// dominated by their definitions.
|
||||||
|
|
|
@ -23,7 +23,7 @@ target_include_directories(SPIRV-Tools-link
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
PRIVATE ${spirv-tools_BINARY_DIR}
|
PRIVATE ${spirv-tools_BINARY_DIR}
|
||||||
)
|
)
|
||||||
# We need the IR functionnalities from the optimizer
|
# We need the IR functionalities from the optimizer
|
||||||
target_link_libraries(SPIRV-Tools-link
|
target_link_libraries(SPIRV-Tools-link
|
||||||
PUBLIC SPIRV-Tools-opt)
|
PUBLIC SPIRV-Tools-opt)
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ spv_result_t CheckImportExportCompatibility(const MessageConsumer& consumer,
|
||||||
|
|
||||||
// Remove linkage specific instructions, such as prototypes of imported
|
// Remove linkage specific instructions, such as prototypes of imported
|
||||||
// functions, declarations of imported variables, import (and export if
|
// functions, declarations of imported variables, import (and export if
|
||||||
// necessary) linkage attribtes.
|
// necessary) linkage attributes.
|
||||||
//
|
//
|
||||||
// |linked_context| and |decoration_manager| should not be null, and the
|
// |linked_context| and |decoration_manager| should not be null, and the
|
||||||
// 'RemoveDuplicatePass' should be run first.
|
// 'RemoveDuplicatePass' should be run first.
|
||||||
|
|
|
@ -40,12 +40,12 @@ struct OpcodeDescPtrLen {
|
||||||
static const spv_opcode_table_t kOpcodeTable = {ARRAY_SIZE(kOpcodeTableEntries),
|
static const spv_opcode_table_t kOpcodeTable = {ARRAY_SIZE(kOpcodeTableEntries),
|
||||||
kOpcodeTableEntries};
|
kOpcodeTableEntries};
|
||||||
|
|
||||||
// Represents a vendor tool entry in the SPIR-V XML Regsitry.
|
// Represents a vendor tool entry in the SPIR-V XML Registry.
|
||||||
struct VendorTool {
|
struct VendorTool {
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
const char* vendor;
|
const char* vendor;
|
||||||
const char* tool; // Might be empty string.
|
const char* tool; // Might be empty string.
|
||||||
const char* vendor_tool; // Combiantion of vendor and tool.
|
const char* vendor_tool; // Combination of vendor and tool.
|
||||||
};
|
};
|
||||||
|
|
||||||
const VendorTool vendor_tools[] = {
|
const VendorTool vendor_tools[] = {
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace spvtools {
|
||||||
namespace opt {
|
namespace opt {
|
||||||
|
|
||||||
// Replaces the extensions VK_AMD_shader_ballot, VK_AMD_gcn_shader, and
|
// Replaces the extensions VK_AMD_shader_ballot, VK_AMD_gcn_shader, and
|
||||||
// VK_AMD_shader_trinary_minmax with equivalant code using core instructions and
|
// VK_AMD_shader_trinary_minmax with equivalent code using core instructions and
|
||||||
// capabilities.
|
// capabilities.
|
||||||
class AmdExtensionToKhrPass : public Pass {
|
class AmdExtensionToKhrPass : public Pass {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -83,7 +83,7 @@ class BasicBlock {
|
||||||
const Instruction* GetMergeInst() const;
|
const Instruction* GetMergeInst() const;
|
||||||
Instruction* GetMergeInst();
|
Instruction* GetMergeInst();
|
||||||
|
|
||||||
// Returns the OpLoopMerge instruciton in this basic block, if it exists.
|
// Returns the OpLoopMerge instruction in this basic block, if it exists.
|
||||||
// Otherwise return null. May be used whenever tail() can be used.
|
// Otherwise return null. May be used whenever tail() can be used.
|
||||||
const Instruction* GetLoopMergeInst() const;
|
const Instruction* GetLoopMergeInst() const;
|
||||||
Instruction* GetLoopMergeInst();
|
Instruction* GetLoopMergeInst();
|
||||||
|
|
|
@ -30,7 +30,7 @@ class CFG {
|
||||||
public:
|
public:
|
||||||
explicit CFG(Module* module);
|
explicit CFG(Module* module);
|
||||||
|
|
||||||
// Return the list of predecesors for basic block with label |blkid|.
|
// Return the list of predecessors for basic block with label |blkid|.
|
||||||
// TODO(dnovillo): Move this to BasicBlock.
|
// TODO(dnovillo): Move this to BasicBlock.
|
||||||
const std::vector<uint32_t>& preds(uint32_t blk_id) const {
|
const std::vector<uint32_t>& preds(uint32_t blk_id) const {
|
||||||
assert(label2preds_.count(blk_id));
|
assert(label2preds_.count(blk_id));
|
||||||
|
|
|
@ -550,7 +550,7 @@ ConstantFoldingRule FoldFAdd() { return FoldFPBinaryOp(FOLD_FPARITH_OP(+)); }
|
||||||
ConstantFoldingRule FoldFMul() { return FoldFPBinaryOp(FOLD_FPARITH_OP(*)); }
|
ConstantFoldingRule FoldFMul() { return FoldFPBinaryOp(FOLD_FPARITH_OP(*)); }
|
||||||
|
|
||||||
// Returns the constant that results from evaluating |numerator| / 0.0. Returns
|
// Returns the constant that results from evaluating |numerator| / 0.0. Returns
|
||||||
// |nullptr| if the result could not be evalutated.
|
// |nullptr| if the result could not be evaluated.
|
||||||
const analysis::Constant* FoldFPScalarDivideByZero(
|
const analysis::Constant* FoldFPScalarDivideByZero(
|
||||||
const analysis::Type* result_type, const analysis::Constant* numerator,
|
const analysis::Type* result_type, const analysis::Constant* numerator,
|
||||||
analysis::ConstantManager* const_mgr) {
|
analysis::ConstantManager* const_mgr) {
|
||||||
|
@ -1346,7 +1346,7 @@ void ConstantFoldingRules::AddFoldingRules() {
|
||||||
FoldFPUnaryOp(FoldFTranscendentalUnary(std::log)));
|
FoldFPUnaryOp(FoldFTranscendentalUnary(std::log)));
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
// Android NDK r15c tageting ABI 15 doesn't have full support for C++11
|
// Android NDK r15c targeting ABI 15 doesn't have full support for C++11
|
||||||
// (no std::exp2/log2). ::exp2 is available from C99 but ::log2 isn't
|
// (no std::exp2/log2). ::exp2 is available from C99 but ::log2 isn't
|
||||||
// available up until ABI 18 so we use a shim
|
// available up until ABI 18 so we use a shim
|
||||||
auto log2_shim = [](double v) -> double { return log(v) / log(2.0); };
|
auto log2_shim = [](double v) -> double { return log(v) / log(2.0); };
|
||||||
|
|
|
@ -541,7 +541,7 @@ class ConstantManager {
|
||||||
// instruction at the end of the current module's types section.
|
// instruction at the end of the current module's types section.
|
||||||
//
|
//
|
||||||
// |type_id| is an optional argument for disambiguating equivalent types. If
|
// |type_id| is an optional argument for disambiguating equivalent types. If
|
||||||
// |type_id| is specified, the contant returned will have that type id.
|
// |type_id| is specified, the constant returned will have that type id.
|
||||||
Instruction* GetDefiningInstruction(const Constant* c, uint32_t type_id = 0,
|
Instruction* GetDefiningInstruction(const Constant* c, uint32_t type_id = 0,
|
||||||
Module::inst_iterator* pos = nullptr);
|
Module::inst_iterator* pos = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ bool ConvertToHalfPass::ProcessPhi(Instruction* inst, uint32_t from_width,
|
||||||
uint32_t to_width) {
|
uint32_t to_width) {
|
||||||
// Add converts of any float operands to to_width if they are of from_width.
|
// Add converts of any float operands to to_width if they are of from_width.
|
||||||
// If converting to 16, change type of phi to float16 equivalent and remember
|
// If converting to 16, change type of phi to float16 equivalent and remember
|
||||||
// result id. Converts need to be added to preceeding blocks.
|
// result id. Converts need to be added to preceding blocks.
|
||||||
uint32_t ocnt = 0;
|
uint32_t ocnt = 0;
|
||||||
uint32_t* prev_idp;
|
uint32_t* prev_idp;
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|
|
@ -158,7 +158,7 @@ class DeadBranchElimPass : public MemPass {
|
||||||
uint32_t cont_id, uint32_t header_id, uint32_t merge_id,
|
uint32_t cont_id, uint32_t header_id, uint32_t merge_id,
|
||||||
std::unordered_set<BasicBlock*>* blocks_with_back_edges);
|
std::unordered_set<BasicBlock*>* blocks_with_back_edges);
|
||||||
|
|
||||||
// Returns true if there is a brach to the merge node of the selection
|
// Returns true if there is a branch to the merge node of the selection
|
||||||
// construct |switch_header_id| that is inside a nested selection construct or
|
// construct |switch_header_id| that is inside a nested selection construct or
|
||||||
// in the header of the nested selection construct.
|
// in the header of the nested selection construct.
|
||||||
bool SwitchHasNestedBreak(uint32_t switch_header_id);
|
bool SwitchHasNestedBreak(uint32_t switch_header_id);
|
||||||
|
|
|
@ -149,7 +149,7 @@ void DebugInfoManager::RegisterDbgDeclare(uint32_t var_id,
|
||||||
// Create new constant directly into global value area, bypassing the
|
// Create new constant directly into global value area, bypassing the
|
||||||
// Constant manager. This is used when the DefUse or Constant managers
|
// Constant manager. This is used when the DefUse or Constant managers
|
||||||
// are invalid and cannot be regenerated due to the module being in an
|
// are invalid and cannot be regenerated due to the module being in an
|
||||||
// inconsistant state e.g. in the middle of significant modification
|
// inconsistent state e.g. in the middle of significant modification
|
||||||
// such as inlining. Invalidate Constant and DefUse managers if used.
|
// such as inlining. Invalidate Constant and DefUse managers if used.
|
||||||
uint32_t AddNewConstInGlobals(IRContext* context, uint32_t const_value) {
|
uint32_t AddNewConstInGlobals(IRContext* context, uint32_t const_value) {
|
||||||
uint32_t id = context->TakeNextId();
|
uint32_t id = context->TakeNextId();
|
||||||
|
|
|
@ -190,7 +190,7 @@ class DefUseManager {
|
||||||
// Returns the annotation instrunctions which are a direct use of the given
|
// Returns the annotation instrunctions which are a direct use of the given
|
||||||
// |id|. This means when the decorations are applied through decoration
|
// |id|. This means when the decorations are applied through decoration
|
||||||
// group(s), this function will just return the OpGroupDecorate
|
// group(s), this function will just return the OpGroupDecorate
|
||||||
// instrcution(s) which refer to the given id as an operand. The OpDecorate
|
// instruction(s) which refer to the given id as an operand. The OpDecorate
|
||||||
// instructions which decorate the decoration group will not be returned.
|
// instructions which decorate the decoration group will not be returned.
|
||||||
std::vector<Instruction*> GetAnnotations(uint32_t id) const;
|
std::vector<Instruction*> GetAnnotations(uint32_t id) const;
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ class DefUseManager {
|
||||||
friend bool CompareAndPrintDifferences(const DefUseManager&,
|
friend bool CompareAndPrintDifferences(const DefUseManager&,
|
||||||
const DefUseManager&);
|
const DefUseManager&);
|
||||||
|
|
||||||
// If |inst| has not already been analysed, then analyses its defintion and
|
// If |inst| has not already been analysed, then analyses its definition and
|
||||||
// uses.
|
// uses.
|
||||||
void UpdateDefUse(Instruction* inst);
|
void UpdateDefUse(Instruction* inst);
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ bool DescriptorScalarReplacement::ReplaceAccessChain(Instruction* var,
|
||||||
|
|
||||||
if (use->NumInOperands() == 2) {
|
if (use->NumInOperands() == 2) {
|
||||||
// We are not indexing into the replacement variable. We can replaces the
|
// We are not indexing into the replacement variable. We can replaces the
|
||||||
// access chain with the replacement varibale itself.
|
// access chain with the replacement variable itself.
|
||||||
context()->ReplaceAllUsesWith(use->result_id(), replacement_var);
|
context()->ReplaceAllUsesWith(use->result_id(), replacement_var);
|
||||||
context()->KillInst(use);
|
context()->KillInst(use);
|
||||||
return true;
|
return true;
|
||||||
|
@ -135,8 +135,8 @@ bool DescriptorScalarReplacement::ReplaceAccessChain(Instruction* var,
|
||||||
// Use the replacement variable as the base address.
|
// Use the replacement variable as the base address.
|
||||||
new_operands.push_back({SPV_OPERAND_TYPE_ID, {replacement_var}});
|
new_operands.push_back({SPV_OPERAND_TYPE_ID, {replacement_var}});
|
||||||
|
|
||||||
// Drop the first index because it is consumed by the replacment, and copy the
|
// Drop the first index because it is consumed by the replacement, and copy
|
||||||
// rest.
|
// the rest.
|
||||||
for (uint32_t i = 4; i < use->NumOperands(); i++) {
|
for (uint32_t i = 4; i < use->NumOperands(); i++) {
|
||||||
new_operands.emplace_back(use->GetOperand(i));
|
new_operands.emplace_back(use->GetOperand(i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace {
|
||||||
// BBType - BasicBlock type. Will either be BasicBlock or DominatorTreeNode
|
// BBType - BasicBlock type. Will either be BasicBlock or DominatorTreeNode
|
||||||
// SuccessorLambda - Lamdba matching the signature of 'const
|
// SuccessorLambda - Lamdba matching the signature of 'const
|
||||||
// std::vector<BBType>*(const BBType *A)'. Will return a vector of the nodes
|
// std::vector<BBType>*(const BBType *A)'. Will return a vector of the nodes
|
||||||
// succeding BasicBlock A.
|
// succeeding BasicBlock A.
|
||||||
// PostLambda - Lamdba matching the signature of 'void (const BBType*)' will be
|
// PostLambda - Lamdba matching the signature of 'void (const BBType*)' will be
|
||||||
// called on each node traversed AFTER their children.
|
// called on each node traversed AFTER their children.
|
||||||
// PreLambda - Lamdba matching the signature of 'void (const BBType*)' will be
|
// PreLambda - Lamdba matching the signature of 'void (const BBType*)' will be
|
||||||
|
@ -69,7 +69,7 @@ static void DepthFirstSearch(const BBType* bb, SuccessorLambda successors,
|
||||||
// BBType - BasicBlock type. Will either be BasicBlock or DominatorTreeNode
|
// BBType - BasicBlock type. Will either be BasicBlock or DominatorTreeNode
|
||||||
// SuccessorLambda - Lamdba matching the signature of 'const
|
// SuccessorLambda - Lamdba matching the signature of 'const
|
||||||
// std::vector<BBType>*(const BBType *A)'. Will return a vector of the nodes
|
// std::vector<BBType>*(const BBType *A)'. Will return a vector of the nodes
|
||||||
// succeding BasicBlock A.
|
// succeeding BasicBlock A.
|
||||||
// PostLambda - Lamdba matching the signature of 'void (const BBType*)' will be
|
// PostLambda - Lamdba matching the signature of 'void (const BBType*)' will be
|
||||||
// called on each node traversed after their children.
|
// called on each node traversed after their children.
|
||||||
template <typename BBType, typename SuccessorLambda, typename PostLambda>
|
template <typename BBType, typename SuccessorLambda, typename PostLambda>
|
||||||
|
|
|
@ -38,7 +38,7 @@ Pass::Status EliminateDeadMembersPass::Process() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EliminateDeadMembersPass::FindLiveMembers() {
|
void EliminateDeadMembersPass::FindLiveMembers() {
|
||||||
// Until we have implemented the rewritting of OpSpecConsantOp instructions,
|
// Until we have implemented the rewriting of OpSpecConsantOp instructions,
|
||||||
// we have to mark them as fully used just to be safe.
|
// we have to mark them as fully used just to be safe.
|
||||||
for (auto& inst : get_module()->types_values()) {
|
for (auto& inst : get_module()->types_values()) {
|
||||||
if (inst.opcode() == SpvOpSpecConstantOp) {
|
if (inst.opcode() == SpvOpSpecConstantOp) {
|
||||||
|
@ -570,7 +570,7 @@ bool EliminateDeadMembersPass::UpdateCompsiteExtract(Instruction* inst) {
|
||||||
Instruction* type_inst = get_def_use_mgr()->GetDef(type_id);
|
Instruction* type_inst = get_def_use_mgr()->GetDef(type_id);
|
||||||
switch (type_inst->opcode()) {
|
switch (type_inst->opcode()) {
|
||||||
case SpvOpTypeStruct:
|
case SpvOpTypeStruct:
|
||||||
// The type will have already been rewriten, so use the new member
|
// The type will have already been rewritten, so use the new member
|
||||||
// index.
|
// index.
|
||||||
type_id = type_inst->GetSingleWordInOperand(new_member_idx);
|
type_id = type_inst->GetSingleWordInOperand(new_member_idx);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -540,7 +540,7 @@ std::vector<uint32_t> InstructionFolder::FoldVectors(
|
||||||
// in 32-bit words here. The reason of not using FoldScalars() here
|
// in 32-bit words here. The reason of not using FoldScalars() here
|
||||||
// is that we do not create temporary null constants as components
|
// is that we do not create temporary null constants as components
|
||||||
// when the vector operand is a NullConstant because Constant creation
|
// when the vector operand is a NullConstant because Constant creation
|
||||||
// may need extra checks for the validity and that is not manageed in
|
// may need extra checks for the validity and that is not managed in
|
||||||
// here.
|
// here.
|
||||||
if (const analysis::ScalarConstant* scalar_component =
|
if (const analysis::ScalarConstant* scalar_component =
|
||||||
vector_operand->GetComponents().at(d)->AsScalarConstant()) {
|
vector_operand->GetComponents().at(d)->AsScalarConstant()) {
|
||||||
|
|
|
@ -115,7 +115,7 @@ bool FoldSpecConstantOpAndCompositePass::ProcessOpSpecConstantOp(
|
||||||
Instruction* folded_inst = nullptr;
|
Instruction* folded_inst = nullptr;
|
||||||
assert(inst->GetInOperand(0).type ==
|
assert(inst->GetInOperand(0).type ==
|
||||||
SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER &&
|
SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER &&
|
||||||
"The first in-operand of OpSpecContantOp instruction must be of "
|
"The first in-operand of OpSpecConstantOp instruction must be of "
|
||||||
"SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER type");
|
"SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER type");
|
||||||
|
|
||||||
switch (static_cast<SpvOp>(inst->GetSingleWordInOperand(0))) {
|
switch (static_cast<SpvOp>(inst->GetSingleWordInOperand(0))) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
// This pass injects code in a graphics shader to implement guarantees
|
// This pass injects code in a graphics shader to implement guarantees
|
||||||
// satisfying Vulkan's robustBufferAcces rules. Robust access rules permit
|
// satisfying Vulkan's robustBufferAccess rules. Robust access rules permit
|
||||||
// an out-of-bounds access to be redirected to an access of the same type
|
// an out-of-bounds access to be redirected to an access of the same type
|
||||||
// (load, store, etc.) but within the same root object.
|
// (load, store, etc.) but within the same root object.
|
||||||
//
|
//
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
// Pointers are always (correctly) typed and so the address and number of
|
// Pointers are always (correctly) typed and so the address and number of
|
||||||
// consecutive locations are fully determined by the pointer.
|
// consecutive locations are fully determined by the pointer.
|
||||||
//
|
//
|
||||||
// - A pointer value orginates as one of few cases:
|
// - A pointer value originates as one of few cases:
|
||||||
//
|
//
|
||||||
// - OpVariable for an interface object or an array of them: image,
|
// - OpVariable for an interface object or an array of them: image,
|
||||||
// buffer (UBO or SSBO), sampler, sampled-image, push-constant, input
|
// buffer (UBO or SSBO), sampler, sampled-image, push-constant, input
|
||||||
|
@ -958,7 +958,7 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer(
|
||||||
constant_mgr->GetDefiningInstruction(component_0)->result_id();
|
constant_mgr->GetDefiningInstruction(component_0)->result_id();
|
||||||
|
|
||||||
// If the image is a cube array, then the last component of the queried
|
// If the image is a cube array, then the last component of the queried
|
||||||
// size is the layer count. In the query, we have to accomodate folding
|
// size is the layer count. In the query, we have to accommodate folding
|
||||||
// in the face index ranging from 0 through 5. The inclusive upper bound
|
// in the face index ranging from 0 through 5. The inclusive upper bound
|
||||||
// on the third coordinate therefore is multiplied by 6.
|
// on the third coordinate therefore is multiplied by 6.
|
||||||
auto* query_size_including_faces = query_size;
|
auto* query_size_including_faces = query_size;
|
||||||
|
|
|
@ -111,7 +111,7 @@ class GraphicsRobustAccessPass : public Pass {
|
||||||
Instruction* max, Instruction* where);
|
Instruction* max, Instruction* where);
|
||||||
|
|
||||||
// Returns a new instruction which evaluates to the length the runtime array
|
// Returns a new instruction which evaluates to the length the runtime array
|
||||||
// referenced by the access chain at the specfied index. The instruction is
|
// referenced by the access chain at the specified index. The instruction is
|
||||||
// inserted before the access chain instruction. Returns a null pointer in
|
// inserted before the access chain instruction. Returns a null pointer in
|
||||||
// some cases if assumptions are violated (rather than asserting out).
|
// some cases if assumptions are violated (rather than asserting out).
|
||||||
opt::Instruction* MakeRuntimeArrayLengthInst(Instruction* access_chain,
|
opt::Instruction* MakeRuntimeArrayLengthInst(Instruction* access_chain,
|
||||||
|
|
|
@ -147,11 +147,11 @@ class InstBindlessCheckPass : public InstrumentPass {
|
||||||
uint32_t GenLastByteIdx(RefAnalysis* ref, InstructionBuilder* builder);
|
uint32_t GenLastByteIdx(RefAnalysis* ref, InstructionBuilder* builder);
|
||||||
|
|
||||||
// Clone original image computation starting at |image_id| into |builder|.
|
// Clone original image computation starting at |image_id| into |builder|.
|
||||||
// This may generate more than one instruction if neccessary.
|
// This may generate more than one instruction if necessary.
|
||||||
uint32_t CloneOriginalImage(uint32_t image_id, InstructionBuilder* builder);
|
uint32_t CloneOriginalImage(uint32_t image_id, InstructionBuilder* builder);
|
||||||
|
|
||||||
// Clone original original reference encapsulated by |ref| into |builder|.
|
// Clone original original reference encapsulated by |ref| into |builder|.
|
||||||
// This may generate more than one instruction if neccessary.
|
// This may generate more than one instruction if necessary.
|
||||||
uint32_t CloneOriginalReference(RefAnalysis* ref,
|
uint32_t CloneOriginalReference(RefAnalysis* ref,
|
||||||
InstructionBuilder* builder);
|
InstructionBuilder* builder);
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ inline bool operator!=(const Operand& o1, const Operand& o2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This structure is used to represent a DebugScope instruction from
|
// This structure is used to represent a DebugScope instruction from
|
||||||
// the OpenCL.100.DebugInfo extened instruction set. Note that we can
|
// the OpenCL.100.DebugInfo extended instruction set. Note that we can
|
||||||
// ignore the result id of DebugScope instruction because it is not
|
// ignore the result id of DebugScope instruction because it is not
|
||||||
// used for anything. We do not keep it to reduce the size of
|
// used for anything. We do not keep it to reduce the size of
|
||||||
// structure.
|
// structure.
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
// A validation pass may read or write multiple buffers. All such buffers
|
// A validation pass may read or write multiple buffers. All such buffers
|
||||||
// are located in a single debug descriptor set whose index is passed at the
|
// are located in a single debug descriptor set whose index is passed at the
|
||||||
// creation of the instrumentation pass. The bindings of the buffers used by
|
// creation of the instrumentation pass. The bindings of the buffers used by
|
||||||
// a validation pass are permanantly assigned and fixed and documented by
|
// a validation pass are permanently assigned and fixed and documented by
|
||||||
// the kDebugOutput* static consts.
|
// the kDebugOutput* static consts.
|
||||||
|
|
||||||
namespace spvtools {
|
namespace spvtools {
|
||||||
|
@ -179,8 +179,8 @@ class InstrumentPass : public Pass {
|
||||||
// the error. Every stage will write a fixed number of words. Vertex shaders
|
// the error. Every stage will write a fixed number of words. Vertex shaders
|
||||||
// will write the Vertex and Instance ID. Fragment shaders will write
|
// will write the Vertex and Instance ID. Fragment shaders will write
|
||||||
// FragCoord.xy. Compute shaders will write the GlobalInvocation ID.
|
// FragCoord.xy. Compute shaders will write the GlobalInvocation ID.
|
||||||
// The tesselation eval shader will write the Primitive ID and TessCoords.uv.
|
// The tessellation eval shader will write the Primitive ID and TessCoords.uv.
|
||||||
// The tesselation control shader and geometry shader will write the
|
// The tessellation control shader and geometry shader will write the
|
||||||
// Primitive ID and Invocation ID.
|
// Primitive ID and Invocation ID.
|
||||||
//
|
//
|
||||||
// The Validation Error Code specifies the exact error which has occurred.
|
// The Validation Error Code specifies the exact error which has occurred.
|
||||||
|
|
|
@ -106,7 +106,7 @@ void IRContext::InvalidateAnalyses(IRContext::Analysis analyses_to_invalidate) {
|
||||||
analyses_to_invalidate |= kAnalysisDebugInfo;
|
analyses_to_invalidate |= kAnalysisDebugInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The dominator analysis hold the psuedo entry and exit nodes from the CFG.
|
// The dominator analysis hold the pseudo entry and exit nodes from the CFG.
|
||||||
// Also if the CFG change the dominators many changed as well, so the
|
// Also if the CFG change the dominators many changed as well, so the
|
||||||
// dominator analysis should be invalidated as well.
|
// dominator analysis should be invalidated as well.
|
||||||
if (analyses_to_invalidate & kAnalysisCFG) {
|
if (analyses_to_invalidate & kAnalysisCFG) {
|
||||||
|
|
|
@ -302,7 +302,7 @@ class IRContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a pointer the decoration manager. If the decoration manger is
|
// Returns a pointer the decoration manager. If the decoration manager is
|
||||||
// invalid, it is rebuilt first.
|
// invalid, it is rebuilt first.
|
||||||
analysis::DecorationManager* get_decoration_mgr() {
|
analysis::DecorationManager* get_decoration_mgr() {
|
||||||
if (!AreAnalysesValid(kAnalysisDecorations)) {
|
if (!AreAnalysesValid(kAnalysisDecorations)) {
|
||||||
|
@ -385,7 +385,7 @@ class IRContext {
|
||||||
|
|
||||||
// Deletes the instruction defining the given |id|. Returns true on
|
// Deletes the instruction defining the given |id|. Returns true on
|
||||||
// success, false if the given |id| is not defined at all. This method also
|
// success, false if the given |id| is not defined at all. This method also
|
||||||
// erases the name, decorations, and defintion of |id|.
|
// erases the name, decorations, and definition of |id|.
|
||||||
//
|
//
|
||||||
// Pointers and iterators pointing to the deleted instructions become invalid.
|
// Pointers and iterators pointing to the deleted instructions become invalid.
|
||||||
// However other pointers and iterators are still valid.
|
// However other pointers and iterators are still valid.
|
||||||
|
@ -802,7 +802,7 @@ class IRContext {
|
||||||
// iterators to traverse instructions.
|
// iterators to traverse instructions.
|
||||||
std::unordered_map<uint32_t, Function*> id_to_func_;
|
std::unordered_map<uint32_t, Function*> id_to_func_;
|
||||||
|
|
||||||
// A bitset indicating which analyes are currently valid.
|
// A bitset indicating which analyzes are currently valid.
|
||||||
Analysis valid_analyses_;
|
Analysis valid_analyses_;
|
||||||
|
|
||||||
// Opcodes of shader capability core executable instructions
|
// Opcodes of shader capability core executable instructions
|
||||||
|
|
|
@ -81,7 +81,7 @@ class LocalAccessChainConvertPass : public MemPass {
|
||||||
std::vector<Operand>* in_opnds);
|
std::vector<Operand>* in_opnds);
|
||||||
|
|
||||||
// Create a load/insert/store equivalent to a store of
|
// Create a load/insert/store equivalent to a store of
|
||||||
// |valId| through (constant index) access chaing |ptrInst|.
|
// |valId| through (constant index) access chain |ptrInst|.
|
||||||
// Append to |newInsts|. Returns true if successful.
|
// Append to |newInsts|. Returns true if successful.
|
||||||
bool GenAccessChainStoreReplacement(
|
bool GenAccessChainStoreReplacement(
|
||||||
const Instruction* ptrInst, uint32_t valId,
|
const Instruction* ptrInst, uint32_t valId,
|
||||||
|
|
|
@ -719,7 +719,7 @@ bool Loop::FindNumberOfIterations(const Instruction* induction,
|
||||||
step_value = -step_value;
|
step_value = -step_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the inital value of the loop and make sure it is a constant integer.
|
// Find the initial value of the loop and make sure it is a constant integer.
|
||||||
int64_t init_value = 0;
|
int64_t init_value = 0;
|
||||||
if (!GetInductionInitValue(induction, &init_value)) return false;
|
if (!GetInductionInitValue(induction, &init_value)) return false;
|
||||||
|
|
||||||
|
@ -751,7 +751,7 @@ bool Loop::FindNumberOfIterations(const Instruction* induction,
|
||||||
// We retrieve the number of iterations using the following formula, diff /
|
// We retrieve the number of iterations using the following formula, diff /
|
||||||
// |step_value| where diff is calculated differently according to the
|
// |step_value| where diff is calculated differently according to the
|
||||||
// |condition| and uses the |condition_value| and |init_value|. If diff /
|
// |condition| and uses the |condition_value| and |init_value|. If diff /
|
||||||
// |step_value| is NOT cleanly divisable then we add one to the sum.
|
// |step_value| is NOT cleanly divisible then we add one to the sum.
|
||||||
int64_t Loop::GetIterations(SpvOp condition, int64_t condition_value,
|
int64_t Loop::GetIterations(SpvOp condition, int64_t condition_value,
|
||||||
int64_t init_value, int64_t step_value) const {
|
int64_t init_value, int64_t step_value) const {
|
||||||
int64_t diff = 0;
|
int64_t diff = 0;
|
||||||
|
@ -795,7 +795,7 @@ int64_t Loop::GetIterations(SpvOp condition, int64_t condition_value,
|
||||||
// If the condition is not met to begin with the loop will never iterate.
|
// If the condition is not met to begin with the loop will never iterate.
|
||||||
if (!(init_value >= condition_value)) return 0;
|
if (!(init_value >= condition_value)) return 0;
|
||||||
|
|
||||||
// We subract one to make it the same as SpvOpGreaterThan as it is
|
// We subtract one to make it the same as SpvOpGreaterThan as it is
|
||||||
// functionally equivalent.
|
// functionally equivalent.
|
||||||
diff = init_value - (condition_value - 1);
|
diff = init_value - (condition_value - 1);
|
||||||
|
|
||||||
|
|
|
@ -395,7 +395,7 @@ class Loop {
|
||||||
// Sets |merge| as the loop merge block. No checks are performed here.
|
// Sets |merge| as the loop merge block. No checks are performed here.
|
||||||
inline void SetMergeBlockImpl(BasicBlock* merge) { loop_merge_ = merge; }
|
inline void SetMergeBlockImpl(BasicBlock* merge) { loop_merge_ = merge; }
|
||||||
|
|
||||||
// Each differnt loop |condition| affects how we calculate the number of
|
// Each different loop |condition| affects how we calculate the number of
|
||||||
// iterations using the |condition_value|, |init_value|, and |step_values| of
|
// iterations using the |condition_value|, |init_value|, and |step_values| of
|
||||||
// the induction variable. This method will return the number of iterations in
|
// the induction variable. This method will return the number of iterations in
|
||||||
// a loop with those values for a given |condition|.
|
// a loop with those values for a given |condition|.
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
// 2 - For each loop in the list, group each instruction into a set of related
|
// 2 - For each loop in the list, group each instruction into a set of related
|
||||||
// instructions by traversing each instructions users and operands recursively.
|
// instructions by traversing each instructions users and operands recursively.
|
||||||
// We stop if we encounter an instruction we have seen before or an instruction
|
// We stop if we encounter an instruction we have seen before or an instruction
|
||||||
// which we don't consider relevent (i.e OpLoopMerge). We then group these
|
// which we don't consider relevant (i.e OpLoopMerge). We then group these
|
||||||
// groups into two different sets, one for the first loop and one for the
|
// groups into two different sets, one for the first loop and one for the
|
||||||
// second.
|
// second.
|
||||||
//
|
//
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace opt {
|
||||||
|
|
||||||
class LoopFissionPass : public Pass {
|
class LoopFissionPass : public Pass {
|
||||||
public:
|
public:
|
||||||
// Fuction used to determine if a given loop should be split. Takes register
|
// Function used to determine if a given loop should be split. Takes register
|
||||||
// pressure region for that loop as a parameter and returns true if the loop
|
// pressure region for that loop as a parameter and returns true if the loop
|
||||||
// should be split.
|
// should be split.
|
||||||
using FissionCriteriaFunction =
|
using FissionCriteriaFunction =
|
||||||
|
|
|
@ -165,7 +165,7 @@ bool LoopFusion::AreCompatible() {
|
||||||
|
|
||||||
// Check adjacency, |loop_0_| should come just before |loop_1_|.
|
// Check adjacency, |loop_0_| should come just before |loop_1_|.
|
||||||
// There is always at least one block between loops, even if it's empty.
|
// There is always at least one block between loops, even if it's empty.
|
||||||
// We'll check at most 2 preceeding blocks.
|
// We'll check at most 2 preceding blocks.
|
||||||
|
|
||||||
auto pre_header_1 = loop_1_->GetPreHeaderBlock();
|
auto pre_header_1 = loop_1_->GetPreHeaderBlock();
|
||||||
|
|
||||||
|
@ -712,7 +712,7 @@ void LoopFusion::Fuse() {
|
||||||
|
|
||||||
ld->RemoveLoop(loop_1_);
|
ld->RemoveLoop(loop_1_);
|
||||||
|
|
||||||
// Kill unnessecary instructions and remove all empty blocks.
|
// Kill unnecessary instructions and remove all empty blocks.
|
||||||
for (auto inst : instr_to_delete) {
|
for (auto inst : instr_to_delete) {
|
||||||
context_->KillInst(inst);
|
context_->KillInst(inst);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ class LoopFusion {
|
||||||
// That means:
|
// That means:
|
||||||
// * they both have one induction variable
|
// * they both have one induction variable
|
||||||
// * they have the same upper and lower bounds
|
// * they have the same upper and lower bounds
|
||||||
// - same inital value
|
// - same initial value
|
||||||
// - same condition
|
// - same condition
|
||||||
// * they have the same update step
|
// * they have the same update step
|
||||||
// * they are adjacent, with |loop_0| appearing before |loop_1|
|
// * they are adjacent, with |loop_0| appearing before |loop_1|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class LoopFusionPass : public Pass {
|
||||||
|
|
||||||
// Processes the given |module|. Returns Status::Failure if errors occur when
|
// Processes the given |module|. Returns Status::Failure if errors occur when
|
||||||
// processing. Returns the corresponding Status::Success if processing is
|
// processing. Returns the corresponding Status::Success if processing is
|
||||||
// succesful to indicate whether changes have been made to the modue.
|
// successful to indicate whether changes have been made to the module.
|
||||||
Status Process() override;
|
Status Process() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -261,7 +261,7 @@ class LoopPeelingPass : public Pass {
|
||||||
|
|
||||||
// Processes the given |module|. Returns Status::Failure if errors occur when
|
// Processes the given |module|. Returns Status::Failure if errors occur when
|
||||||
// processing. Returns the corresponding Status::Success if processing is
|
// processing. Returns the corresponding Status::Success if processing is
|
||||||
// succesful to indicate whether changes have been made to the modue.
|
// successful to indicate whether changes have been made to the module.
|
||||||
Pass::Status Process() override;
|
Pass::Status Process() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -163,7 +163,7 @@ struct LoopUnrollState {
|
||||||
};
|
};
|
||||||
|
|
||||||
// This class implements the actual unrolling. It uses a LoopUnrollState to
|
// This class implements the actual unrolling. It uses a LoopUnrollState to
|
||||||
// maintain the state of the unrolling inbetween steps.
|
// maintain the state of the unrolling in between steps.
|
||||||
class LoopUnrollerUtilsImpl {
|
class LoopUnrollerUtilsImpl {
|
||||||
public:
|
public:
|
||||||
using BasicBlockListTy = std::vector<std::unique_ptr<BasicBlock>>;
|
using BasicBlockListTy = std::vector<std::unique_ptr<BasicBlock>>;
|
||||||
|
@ -209,7 +209,7 @@ class LoopUnrollerUtilsImpl {
|
||||||
// Add all blocks_to_add_ to function_ at the |insert_point|.
|
// Add all blocks_to_add_ to function_ at the |insert_point|.
|
||||||
void AddBlocksToFunction(const BasicBlock* insert_point);
|
void AddBlocksToFunction(const BasicBlock* insert_point);
|
||||||
|
|
||||||
// Duplicates the |old_loop|, cloning each body and remaping the ids without
|
// Duplicates the |old_loop|, cloning each body and remapping the ids without
|
||||||
// removing instructions or changing relative structure. Result will be stored
|
// removing instructions or changing relative structure. Result will be stored
|
||||||
// in |new_loop|.
|
// in |new_loop|.
|
||||||
void DuplicateLoop(Loop* old_loop, Loop* new_loop);
|
void DuplicateLoop(Loop* old_loop, Loop* new_loop);
|
||||||
|
@ -241,7 +241,7 @@ class LoopUnrollerUtilsImpl {
|
||||||
// Remap all the in |basic_block| to new IDs and keep the mapping of new ids
|
// Remap all the in |basic_block| to new IDs and keep the mapping of new ids
|
||||||
// to old
|
// to old
|
||||||
// ids. |loop| is used to identify special loop blocks (header, continue,
|
// ids. |loop| is used to identify special loop blocks (header, continue,
|
||||||
// ect).
|
// etc).
|
||||||
void AssignNewResultIds(BasicBlock* basic_block);
|
void AssignNewResultIds(BasicBlock* basic_block);
|
||||||
|
|
||||||
// Using the map built by AssignNewResultIds, replace the uses in |inst|
|
// Using the map built by AssignNewResultIds, replace the uses in |inst|
|
||||||
|
@ -320,7 +320,7 @@ class LoopUnrollerUtilsImpl {
|
||||||
// and then be remapped at the end.
|
// and then be remapped at the end.
|
||||||
std::vector<Instruction*> loop_phi_instructions_;
|
std::vector<Instruction*> loop_phi_instructions_;
|
||||||
|
|
||||||
// The number of loop iterations that the loop would preform pre-unroll.
|
// The number of loop iterations that the loop would perform pre-unroll.
|
||||||
size_t number_of_loop_iterations_;
|
size_t number_of_loop_iterations_;
|
||||||
|
|
||||||
// The amount that the loop steps each iteration.
|
// The amount that the loop steps each iteration.
|
||||||
|
@ -839,7 +839,7 @@ void LoopUnrollerUtilsImpl::DuplicateLoop(Loop* old_loop, Loop* new_loop) {
|
||||||
new_loop->SetMergeBlock(new_merge);
|
new_loop->SetMergeBlock(new_merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Whenever the utility copies a block it stores it in a tempory buffer, this
|
// Whenever the utility copies a block it stores it in a temporary buffer, this
|
||||||
// function adds the buffer into the Function. The blocks will be inserted
|
// function adds the buffer into the Function. The blocks will be inserted
|
||||||
// after the block |insert_point|.
|
// after the block |insert_point|.
|
||||||
void LoopUnrollerUtilsImpl::AddBlocksToFunction(
|
void LoopUnrollerUtilsImpl::AddBlocksToFunction(
|
||||||
|
|
|
@ -118,7 +118,7 @@ class LoopUnswitch {
|
||||||
|
|
||||||
// Find a value that can be used to select the default path.
|
// Find a value that can be used to select the default path.
|
||||||
// If none are possible, then it will just use 0. The value does not matter
|
// If none are possible, then it will just use 0. The value does not matter
|
||||||
// because this path will never be taken becaues the new switch outside of
|
// because this path will never be taken because the new switch outside of
|
||||||
// the loop cannot select this path either.
|
// the loop cannot select this path either.
|
||||||
std::vector<uint32_t> existing_values;
|
std::vector<uint32_t> existing_values;
|
||||||
for (uint32_t i = 2; i < switch_inst->NumInOperands(); i += 2) {
|
for (uint32_t i = 2; i < switch_inst->NumInOperands(); i += 2) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ class LoopUnswitchPass : public Pass {
|
||||||
|
|
||||||
// Processes the given |module|. Returns Status::Failure if errors occur when
|
// Processes the given |module|. Returns Status::Failure if errors occur when
|
||||||
// processing. Returns the corresponding Status::Success if processing is
|
// processing. Returns the corresponding Status::Success if processing is
|
||||||
// succesful to indicate whether changes have been made to the modue.
|
// successful to indicate whether changes have been made to the module.
|
||||||
Pass::Status Process() override;
|
Pass::Status Process() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -123,7 +123,7 @@ class LoopUtils {
|
||||||
// Clone the |loop_| and make the new loop branch to the second loop on exit.
|
// Clone the |loop_| and make the new loop branch to the second loop on exit.
|
||||||
Loop* CloneAndAttachLoopToHeader(LoopCloningResult* cloning_result);
|
Loop* CloneAndAttachLoopToHeader(LoopCloningResult* cloning_result);
|
||||||
|
|
||||||
// Perfom a partial unroll of |loop| by given |factor|. This will copy the
|
// Perform a partial unroll of |loop| by given |factor|. This will copy the
|
||||||
// body of the loop |factor| times. So a |factor| of one would give a new loop
|
// body of the loop |factor| times. So a |factor| of one would give a new loop
|
||||||
// with the original body plus one unrolled copy body.
|
// with the original body plus one unrolled copy body.
|
||||||
bool PartiallyUnroll(size_t factor);
|
bool PartiallyUnroll(size_t factor);
|
||||||
|
@ -139,7 +139,7 @@ class LoopUtils {
|
||||||
// 1. That the loop is in structured order.
|
// 1. That the loop is in structured order.
|
||||||
// 2. That the continue block is a branch to the header.
|
// 2. That the continue block is a branch to the header.
|
||||||
// 3. That the only phi used in the loop is the induction variable.
|
// 3. That the only phi used in the loop is the induction variable.
|
||||||
// TODO(stephen@codeplay.com): This is a temporary mesure, after the loop is
|
// TODO(stephen@codeplay.com): This is a temporary measure, after the loop is
|
||||||
// converted into LCSAA form and has a single entry and exit we can rewrite
|
// converted into LCSAA form and has a single entry and exit we can rewrite
|
||||||
// the other phis.
|
// the other phis.
|
||||||
// 4. That this is an inner most loop, or that loops contained within this
|
// 4. That this is an inner most loop, or that loops contained within this
|
||||||
|
|
|
@ -247,7 +247,7 @@ class MergeReturnPass : public MemPass {
|
||||||
|
|
||||||
// Add new phi nodes for any id that no longer dominate all of it uses. A phi
|
// Add new phi nodes for any id that no longer dominate all of it uses. A phi
|
||||||
// node is added to a block |bb| for an id if the id is defined between the
|
// node is added to a block |bb| for an id if the id is defined between the
|
||||||
// original immediate dominator of |bb| and its new immidiate dominator. It
|
// original immediate dominator of |bb| and its new immediate dominator. It
|
||||||
// is assumed that at this point there are no unreachable blocks in the
|
// is assumed that at this point there are no unreachable blocks in the
|
||||||
// control flow graph.
|
// control flow graph.
|
||||||
void AddNewPhiNodes();
|
void AddNewPhiNodes();
|
||||||
|
@ -273,7 +273,7 @@ class MergeReturnPass : public MemPass {
|
||||||
void InsertAfterElement(BasicBlock* element, BasicBlock* new_element,
|
void InsertAfterElement(BasicBlock* element, BasicBlock* new_element,
|
||||||
std::list<BasicBlock*>* list);
|
std::list<BasicBlock*>* list);
|
||||||
|
|
||||||
// Creates a single case switch around all of the exectuable code of the
|
// Creates a single case switch around all of the executable code of the
|
||||||
// current function where the switch and case value are both zero and the
|
// current function where the switch and case value are both zero and the
|
||||||
// default is the merge block. Returns after the switch is executed. Sets
|
// default is the merge block. Returns after the switch is executed. Sets
|
||||||
// |final_return_block_|.
|
// |final_return_block_|.
|
||||||
|
|
|
@ -129,7 +129,7 @@ class Pass {
|
||||||
|
|
||||||
// Processes the given |module|. Returns Status::Failure if errors occur when
|
// Processes the given |module|. Returns Status::Failure if errors occur when
|
||||||
// processing. Returns the corresponding Status::Success if processing is
|
// processing. Returns the corresponding Status::Success if processing is
|
||||||
// succesful to indicate whether changes are made to the module.
|
// successful to indicate whether changes are made to the module.
|
||||||
virtual Status Process() = 0;
|
virtual Status Process() = 0;
|
||||||
|
|
||||||
// Return the next available SSA id and increment it.
|
// Return the next available SSA id and increment it.
|
||||||
|
|
|
@ -54,7 +54,7 @@ class PassManager {
|
||||||
// Adds an externally constructed pass.
|
// Adds an externally constructed pass.
|
||||||
void AddPass(std::unique_ptr<Pass> pass);
|
void AddPass(std::unique_ptr<Pass> pass);
|
||||||
// Uses the argument |args| to construct a pass instance of type |T|, and adds
|
// Uses the argument |args| to construct a pass instance of type |T|, and adds
|
||||||
// the pass instance to this pass manger. The pass added will use this pass
|
// the pass instance to this pass manager. The pass added will use this pass
|
||||||
// manager's message consumer.
|
// manager's message consumer.
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
void AddPass(Args&&... args);
|
void AddPass(Args&&... args);
|
||||||
|
@ -70,7 +70,7 @@ class PassManager {
|
||||||
// Runs all passes on the given |module|. Returns Status::Failure if errors
|
// Runs all passes on the given |module|. Returns Status::Failure if errors
|
||||||
// occur when processing using one of the registered passes. All passes
|
// occur when processing using one of the registered passes. All passes
|
||||||
// registered after the error-reporting pass will be skipped. Returns the
|
// registered after the error-reporting pass will be skipped. Returns the
|
||||||
// corresponding Status::Success if processing is succesful to indicate
|
// corresponding Status::Success if processing is successful to indicate
|
||||||
// whether changes are made to the module.
|
// whether changes are made to the module.
|
||||||
//
|
//
|
||||||
// After running all the passes, they are removed from the list.
|
// After running all the passes, they are removed from the list.
|
||||||
|
|
|
@ -44,7 +44,7 @@ class PrivateToLocalPass : public Pass {
|
||||||
// class of |function|. Returns false if the variable could not be moved.
|
// class of |function|. Returns false if the variable could not be moved.
|
||||||
bool MoveVariable(Instruction* variable, Function* function);
|
bool MoveVariable(Instruction* variable, Function* function);
|
||||||
|
|
||||||
// |inst| is an instruction declaring a varible. If that variable is
|
// |inst| is an instruction declaring a variable. If that variable is
|
||||||
// referenced in a single function and all of uses are valid as defined by
|
// referenced in a single function and all of uses are valid as defined by
|
||||||
// |IsValidUse|, then that function is returned. Otherwise, the return
|
// |IsValidUse|, then that function is returned. Otherwise, the return
|
||||||
// value is |nullptr|.
|
// value is |nullptr|.
|
||||||
|
|
|
@ -41,7 +41,7 @@ class RedundancyEliminationPass : public LocalRedundancyEliminationPass {
|
||||||
// in the function containing |bb|.
|
// in the function containing |bb|.
|
||||||
//
|
//
|
||||||
// |value_to_ids| is a map from value number to ids. If {vn, id} is in
|
// |value_to_ids| is a map from value number to ids. If {vn, id} is in
|
||||||
// |value_to_ids| then vn is the value number of id, and the defintion of id
|
// |value_to_ids| then vn is the value number of id, and the definition of id
|
||||||
// dominates |bb|.
|
// dominates |bb|.
|
||||||
//
|
//
|
||||||
// Returns true if at least one instruction is deleted.
|
// Returns true if at least one instruction is deleted.
|
||||||
|
|
|
@ -47,7 +47,7 @@ class ReplaceDescArrayAccessUsingVarIndex : public Pass {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Replaces all acceses to |var| using variable indices with constant
|
// Replaces all accesses to |var| using variable indices with constant
|
||||||
// elements of the array |var|. Creates switch-case statements to determine
|
// elements of the array |var|. Creates switch-case statements to determine
|
||||||
// the value of the variable index for all the possible cases. Returns
|
// the value of the variable index for all the possible cases. Returns
|
||||||
// whether replacement is done or not.
|
// whether replacement is done or not.
|
||||||
|
@ -170,7 +170,7 @@ class ReplaceDescArrayAccessUsingVarIndex : public Pass {
|
||||||
// Creates and adds an OpSwitch used for the selection of OpAccessChain whose
|
// Creates and adds an OpSwitch used for the selection of OpAccessChain whose
|
||||||
// first Indexes operand is |access_chain_index_var_id|. The OpSwitch will be
|
// first Indexes operand is |access_chain_index_var_id|. The OpSwitch will be
|
||||||
// added at the end of |parent_block|. It will jump to |default_id| for the
|
// added at the end of |parent_block|. It will jump to |default_id| for the
|
||||||
// default case and jumps to one of case blocks whoes ids are |case_block_ids|
|
// default case and jumps to one of case blocks whose ids are |case_block_ids|
|
||||||
// if |access_chain_index_var_id| matches the case number. |merge_id| is the
|
// if |access_chain_index_var_id| matches the case number. |merge_id| is the
|
||||||
// merge block id.
|
// merge block id.
|
||||||
void AddSwitchForAccessChain(
|
void AddSwitchForAccessChain(
|
||||||
|
|
|
@ -581,7 +581,7 @@ static void PushToString(T id, std::u32string* str) {
|
||||||
|
|
||||||
// Implements the hashing of SENodes.
|
// Implements the hashing of SENodes.
|
||||||
size_t SENodeHash::operator()(const SENode* node) const {
|
size_t SENodeHash::operator()(const SENode* node) const {
|
||||||
// Concatinate the terms into a string which we can hash.
|
// Concatenate the terms into a string which we can hash.
|
||||||
std::u32string hash_string{};
|
std::u32string hash_string{};
|
||||||
|
|
||||||
// Hashing the type as a string is safer than hashing the enum as the enum is
|
// Hashing the type as a string is safer than hashing the enum as the enum is
|
||||||
|
|
|
@ -167,7 +167,7 @@ class SENode {
|
||||||
const ChildContainerType& GetChildren() const { return children_; }
|
const ChildContainerType& GetChildren() const { return children_; }
|
||||||
ChildContainerType& GetChildren() { return children_; }
|
ChildContainerType& GetChildren() { return children_; }
|
||||||
|
|
||||||
// Return true if this node is a cant compute node.
|
// Return true if this node is a can't compute node.
|
||||||
bool IsCantCompute() const { return GetType() == CanNotCompute; }
|
bool IsCantCompute() const { return GetType() == CanNotCompute; }
|
||||||
|
|
||||||
// Implements a casting method for each type.
|
// Implements a casting method for each type.
|
||||||
|
|
|
@ -88,7 +88,7 @@ class SENodeSimplifyImpl {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Recursively descend through the graph to build up the accumulator objects
|
// Recursively descend through the graph to build up the accumulator objects
|
||||||
// which are used to flatten the graph. |child| is the node currenty being
|
// which are used to flatten the graph. |child| is the node currently being
|
||||||
// traversed and the |negation| flag is used to signify that this operation
|
// traversed and the |negation| flag is used to signify that this operation
|
||||||
// was preceded by a unary negative operation and as such the result should be
|
// was preceded by a unary negative operation and as such the result should be
|
||||||
// negated.
|
// negated.
|
||||||
|
|
|
@ -151,7 +151,7 @@ Pass::Status UnifyConstantPass::Process() {
|
||||||
// 'SpecId' decoration and all of them should be treated as unique.
|
// 'SpecId' decoration and all of them should be treated as unique.
|
||||||
// 'SpecId' is not applicable to SpecConstants defined with
|
// 'SpecId' is not applicable to SpecConstants defined with
|
||||||
// OpSpecConstant{Op|Composite}, their values are not necessary to be
|
// OpSpecConstant{Op|Composite}, their values are not necessary to be
|
||||||
// unique. When all the operands/compoents are the same between two
|
// unique. When all the operands/components are the same between two
|
||||||
// OpSpecConstant{Op|Composite} results, their result values must be the
|
// OpSpecConstant{Op|Composite} results, their result values must be the
|
||||||
// same so are unifiable.
|
// same so are unifiable.
|
||||||
case SpvOp::SpvOpSpecConstantOp:
|
case SpvOp::SpvOpSpecConstantOp:
|
||||||
|
|
|
@ -73,7 +73,7 @@ class VectorDCE : public MemPass {
|
||||||
bool RewriteInstructions(Function* function,
|
bool RewriteInstructions(Function* function,
|
||||||
const LiveComponentMap& live_components);
|
const LiveComponentMap& live_components);
|
||||||
|
|
||||||
// Makrs all DebugValue instructions that use |composite| for their values as
|
// Makes all DebugValue instructions that use |composite| for their values as
|
||||||
// dead instructions by putting them into |dead_dbg_value|.
|
// dead instructions by putting them into |dead_dbg_value|.
|
||||||
void MarkDebugValueUsesAsDead(Instruction* composite,
|
void MarkDebugValueUsesAsDead(Instruction* composite,
|
||||||
std::vector<Instruction*>* dead_dbg_value);
|
std::vector<Instruction*>* dead_dbg_value);
|
||||||
|
|
|
@ -153,7 +153,7 @@ void RemoveStructMemberReductionOpportunity::AdjustAccessedIndices(
|
||||||
next_type = type_inst->GetSingleWordInOperand(0);
|
next_type = type_inst->GetSingleWordInOperand(0);
|
||||||
break;
|
break;
|
||||||
case SpvOpTypeStruct: {
|
case SpvOpTypeStruct: {
|
||||||
// Struct types are special becuase (a) we may need to adjust the index
|
// Struct types are special because (a) we may need to adjust the index
|
||||||
// being used, if the struct type is the one from which we are removing
|
// being used, if the struct type is the one from which we are removing
|
||||||
// a member, and (b) the type encountered by following the current index
|
// a member, and (b) the type encountered by following the current index
|
||||||
// is dependent on the value of the index.
|
// is dependent on the value of the index.
|
||||||
|
|
|
@ -136,9 +136,9 @@ RemoveUnusedStructMemberReductionOpportunityFinder::GetAvailableOpportunities(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We now know those struct indices that are unsed, and we make a reduction
|
// We now know those struct indices that are unused, and we make a reduction
|
||||||
// opportunity for each of them. By mapping each relevant member index to the
|
// opportunity for each of them. By mapping each relevant member index to the
|
||||||
// structs in which it is unsed, we will group all opportunities to remove
|
// structs in which it is unused, we will group all opportunities to remove
|
||||||
// member k of a struct (for some k) together. This reduces the likelihood
|
// member k of a struct (for some k) together. This reduces the likelihood
|
||||||
// that opportunities to remove members from the same struct will be adjacent,
|
// that opportunities to remove members from the same struct will be adjacent,
|
||||||
// which is good because such opportunities mutually disable one another.
|
// which is good because such opportunities mutually disable one another.
|
||||||
|
|
|
@ -96,7 +96,7 @@ StructuredConstructToBlockReductionOpportunityFinder::GetAvailableOpportunities(
|
||||||
// This also means that we don't add a region.
|
// This also means that we don't add a region.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// We have a reachable header block with a rechable merge that
|
// We have a reachable header block with a reachable merge that
|
||||||
// postdominates the header: this means we have a new region.
|
// postdominates the header: this means we have a new region.
|
||||||
regions.emplace(&block, std::unordered_set<opt::BasicBlock*>());
|
regions.emplace(&block, std::unordered_set<opt::BasicBlock*>());
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ bool StructuredConstructToBlockReductionOpportunityFinder::
|
||||||
if (!block->WhileEachInst(
|
if (!block->WhileEachInst(
|
||||||
[context, &header, ®ion](opt::Instruction* inst) -> bool {
|
[context, &header, ®ion](opt::Instruction* inst) -> bool {
|
||||||
if (inst->result_id() == 0) {
|
if (inst->result_id() == 0) {
|
||||||
// The instruction does not genreate a result id, thus it cannot
|
// The instruction does not generate a result id, thus it cannot
|
||||||
// be referred to outside the region - this is fine.
|
// be referred to outside the region - this is fine.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ typedef struct spv_header_t {
|
||||||
uint32_t generator;
|
uint32_t generator;
|
||||||
uint32_t bound;
|
uint32_t bound;
|
||||||
uint32_t schema; // NOTE: Reserved
|
uint32_t schema; // NOTE: Reserved
|
||||||
const uint32_t* instructions; // NOTE: Unfixed pointer to instruciton stream
|
const uint32_t* instructions; // NOTE: Unfixed pointer to instruction stream
|
||||||
} spv_header_t;
|
} spv_header_t;
|
||||||
|
|
||||||
#endif // SOURCE_SPIRV_DEFINITION_H_
|
#endif // SOURCE_SPIRV_DEFINITION_H_
|
||||||
|
|
|
@ -31,7 +31,7 @@ uint64_t spvFixDoubleWord(const uint32_t low, const uint32_t high,
|
||||||
spv_result_t spvBinaryEndianness(const spv_const_binary binary,
|
spv_result_t spvBinaryEndianness(const spv_const_binary binary,
|
||||||
spv_endianness_t* endian);
|
spv_endianness_t* endian);
|
||||||
|
|
||||||
// Returns true if the given endianness matches the host's native endiannes.
|
// Returns true if the given endianness matches the host's native endianness.
|
||||||
bool spvIsHostEndian(spv_endianness_t endian);
|
bool spvIsHostEndian(spv_endianness_t endian);
|
||||||
|
|
||||||
#endif // SOURCE_SPIRV_ENDIAN_H_
|
#endif // SOURCE_SPIRV_ENDIAN_H_
|
||||||
|
|
|
@ -40,7 +40,7 @@ std::string spvLogStringForEnv(spv_target_env env);
|
||||||
|
|
||||||
// Returns a formatted list of all SPIR-V target environment names that
|
// Returns a formatted list of all SPIR-V target environment names that
|
||||||
// can be parsed by spvParseTargetEnv.
|
// can be parsed by spvParseTargetEnv.
|
||||||
// |pad| is the number of space characters that the begining of each line
|
// |pad| is the number of space characters that the beginning of each line
|
||||||
// except the first one will be padded with.
|
// except the first one will be padded with.
|
||||||
// |wrap| is the max length of lines the user desires. Word-wrapping will
|
// |wrap| is the max length of lines the user desires. Word-wrapping will
|
||||||
// occur to satisfy this limit.
|
// occur to satisfy this limit.
|
||||||
|
|
|
@ -32,7 +32,7 @@ class BitVector {
|
||||||
enum { kInitialNumBits = 1024 };
|
enum { kInitialNumBits = 1024 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Creates a bit vector contianing 0s.
|
// Creates a bit vector containing 0s.
|
||||||
BitVector(uint32_t reserved_size = kInitialNumBits)
|
BitVector(uint32_t reserved_size = kInitialNumBits)
|
||||||
: bits_((reserved_size - 1) / kBitContainerSize + 1, 0) {}
|
: bits_((reserved_size - 1) / kBitContainerSize + 1, 0) {}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class IntrusiveList {
|
||||||
// Moves the contents of the given list to the list being constructed.
|
// Moves the contents of the given list to the list being constructed.
|
||||||
IntrusiveList(IntrusiveList&&);
|
IntrusiveList(IntrusiveList&&);
|
||||||
|
|
||||||
// Destorys the list. Note that the elements of the list will not be deleted,
|
// Destroys the list. Note that the elements of the list will not be deleted,
|
||||||
// but they will be removed from the list.
|
// but they will be removed from the list.
|
||||||
virtual ~IntrusiveList();
|
virtual ~IntrusiveList();
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ EncodeNumberStatus ParseAndEncodeIntegerNumber(
|
||||||
std::function<void(uint32_t)> emit, std::string* error_msg);
|
std::function<void(uint32_t)> emit, std::string* error_msg);
|
||||||
|
|
||||||
// Parses a floating point value of a given |type| from the given |text| and
|
// Parses a floating point value of a given |type| from the given |text| and
|
||||||
// encodes the number by the given |emit| funciton. On success, returns
|
// encodes the number by the given |emit| function. On success, returns
|
||||||
// EncodeNumberStatus::kSuccess and the parsed number will be consumed by the
|
// EncodeNumberStatus::kSuccess and the parsed number will be consumed by the
|
||||||
// given |emit| function word by word (least significant word first). On
|
// given |emit| function word by word (least significant word first). On
|
||||||
// failure, this function returns the error code of the encoding status and
|
// failure, this function returns the error code of the encoding status and
|
||||||
|
|
|
@ -366,7 +366,7 @@ class SmallVector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upate the size.
|
// Update the size.
|
||||||
size_ += num_of_new_elements;
|
size_ += num_of_new_elements;
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
@ -452,7 +452,7 @@ class SmallVector {
|
||||||
T* small_data_;
|
T* small_data_;
|
||||||
|
|
||||||
// The actual data used to store the array elements. It must never be used
|
// The actual data used to store the array elements. It must never be used
|
||||||
// directly, but must only be accesed through |small_data_|.
|
// directly, but must only be accessed through |small_data_|.
|
||||||
typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type
|
typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type
|
||||||
buffer[small_size];
|
buffer[small_size];
|
||||||
|
|
||||||
|
|
|
@ -206,16 +206,16 @@ class Timer {
|
||||||
|
|
||||||
// Variable to save the result of clock_gettime(CLOCK_PROCESS_CPUTIME_ID) when
|
// Variable to save the result of clock_gettime(CLOCK_PROCESS_CPUTIME_ID) when
|
||||||
// Timer::Stop() is called. It is used as the last status of CPU time. The
|
// Timer::Stop() is called. It is used as the last status of CPU time. The
|
||||||
// resouce usage is measured by subtracting |cpu_before_| from it.
|
// resource usage is measured by subtracting |cpu_before_| from it.
|
||||||
timespec cpu_after_;
|
timespec cpu_after_;
|
||||||
|
|
||||||
// Variable to save the result of clock_gettime(CLOCK_MONOTONIC) when
|
// Variable to save the result of clock_gettime(CLOCK_MONOTONIC) when
|
||||||
// Timer::Stop() is called. It is used as the last status of WALL time. The
|
// Timer::Stop() is called. It is used as the last status of WALL time. The
|
||||||
// resouce usage is measured by subtracting |wall_before_| from it.
|
// resource usage is measured by subtracting |wall_before_| from it.
|
||||||
timespec wall_after_;
|
timespec wall_after_;
|
||||||
|
|
||||||
// Variable to save the result of getrusage() when Timer::Stop() is called. It
|
// Variable to save the result of getrusage() when Timer::Stop() is called. It
|
||||||
// is used as the last status of USR time, SYS time, and RSS. Those resouce
|
// is used as the last status of USR time, SYS time, and RSS. Those resource
|
||||||
// usages are measured by subtracting |usage_before_| from it.
|
// usages are measured by subtracting |usage_before_| from it.
|
||||||
rusage usage_after_;
|
rusage usage_after_;
|
||||||
|
|
||||||
|
|
|
@ -84,26 +84,26 @@ class BasicBlock {
|
||||||
type_.set(type);
|
type_.set(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the immedate dominator of this basic block
|
/// Sets the immediate dominator of this basic block
|
||||||
///
|
///
|
||||||
/// @param[in] dom_block The dominator block
|
/// @param[in] dom_block The dominator block
|
||||||
void SetImmediateDominator(BasicBlock* dom_block);
|
void SetImmediateDominator(BasicBlock* dom_block);
|
||||||
|
|
||||||
/// Sets the immedate post dominator of this basic block
|
/// Sets the immediate post dominator of this basic block
|
||||||
///
|
///
|
||||||
/// @param[in] pdom_block The post dominator block
|
/// @param[in] pdom_block The post dominator block
|
||||||
void SetImmediatePostDominator(BasicBlock* pdom_block);
|
void SetImmediatePostDominator(BasicBlock* pdom_block);
|
||||||
|
|
||||||
/// Returns the immedate dominator of this basic block
|
/// Returns the immediate dominator of this basic block
|
||||||
BasicBlock* immediate_dominator();
|
BasicBlock* immediate_dominator();
|
||||||
|
|
||||||
/// Returns the immedate dominator of this basic block
|
/// Returns the immediate dominator of this basic block
|
||||||
const BasicBlock* immediate_dominator() const;
|
const BasicBlock* immediate_dominator() const;
|
||||||
|
|
||||||
/// Returns the immedate post dominator of this basic block
|
/// Returns the immediate post dominator of this basic block
|
||||||
BasicBlock* immediate_post_dominator();
|
BasicBlock* immediate_post_dominator();
|
||||||
|
|
||||||
/// Returns the immedate post dominator of this basic block
|
/// Returns the immediate post dominator of this basic block
|
||||||
const BasicBlock* immediate_post_dominator() const;
|
const BasicBlock* immediate_post_dominator() const;
|
||||||
|
|
||||||
/// Returns the label instruction for the block, or nullptr if not set.
|
/// Returns the label instruction for the block, or nullptr if not set.
|
||||||
|
|
|
@ -57,7 +57,7 @@ spv_result_t Function::RegisterFunctionParameter(uint32_t parameter_id,
|
||||||
uint32_t type_id) {
|
uint32_t type_id) {
|
||||||
assert(current_block_ == nullptr &&
|
assert(current_block_ == nullptr &&
|
||||||
"RegisterFunctionParameter can only be called when parsing the binary "
|
"RegisterFunctionParameter can only be called when parsing the binary "
|
||||||
"ouside of a block");
|
"outside of a block");
|
||||||
// TODO(umar): Validate function parameter type order and count
|
// TODO(umar): Validate function parameter type order and count
|
||||||
// TODO(umar): Use these variables to validate parameter type
|
// TODO(umar): Use these variables to validate parameter type
|
||||||
(void)parameter_id;
|
(void)parameter_id;
|
||||||
|
@ -130,7 +130,7 @@ spv_result_t Function::RegisterBlock(uint32_t block_id, bool is_definition) {
|
||||||
undefined_blocks_.erase(block_id);
|
undefined_blocks_.erase(block_id);
|
||||||
current_block_ = &inserted_block->second;
|
current_block_ = &inserted_block->second;
|
||||||
ordered_blocks_.push_back(current_block_);
|
ordered_blocks_.push_back(current_block_);
|
||||||
} else if (success) { // Block doesn't exsist but this is not a definition
|
} else if (success) { // Block doesn't exist but this is not a definition
|
||||||
undefined_blocks_.insert(block_id);
|
undefined_blocks_.insert(block_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,8 @@ class Function {
|
||||||
|
|
||||||
/// Registers a variable in the current block
|
/// Registers a variable in the current block
|
||||||
///
|
///
|
||||||
/// @param[in] type_id The type ID of the varaible
|
/// @param[in] type_id The type ID of the variable
|
||||||
/// @param[in] id The ID of the varaible
|
/// @param[in] id The ID of the variable
|
||||||
/// @param[in] storage The storage of the variable
|
/// @param[in] storage The storage of the variable
|
||||||
/// @param[in] init_id The initializer ID of the variable
|
/// @param[in] init_id The initializer ID of the variable
|
||||||
///
|
///
|
||||||
|
@ -197,10 +197,10 @@ class Function {
|
||||||
/// been identified and dominators have been computed.
|
/// been identified and dominators have been computed.
|
||||||
int GetBlockDepth(BasicBlock* bb);
|
int GetBlockDepth(BasicBlock* bb);
|
||||||
|
|
||||||
/// Prints a GraphViz digraph of the CFG of the current funciton
|
/// Prints a GraphViz digraph of the CFG of the current function
|
||||||
void PrintDotGraph() const;
|
void PrintDotGraph() const;
|
||||||
|
|
||||||
/// Prints a directed graph of the CFG of the current funciton
|
/// Prints a directed graph of the CFG of the current function
|
||||||
void PrintBlocks() const;
|
void PrintBlocks() const;
|
||||||
|
|
||||||
/// Registers execution model limitation such as "Feature X is only available
|
/// Registers execution model limitation such as "Feature X is only available
|
||||||
|
@ -285,7 +285,7 @@ class Function {
|
||||||
/// The type of the return value
|
/// The type of the return value
|
||||||
uint32_t result_type_id_;
|
uint32_t result_type_id_;
|
||||||
|
|
||||||
/// The control fo the funciton
|
/// The control fo the function
|
||||||
SpvFunctionControlMask function_control_;
|
SpvFunctionControlMask function_control_;
|
||||||
|
|
||||||
/// The type of declaration of each function
|
/// The type of declaration of each function
|
||||||
|
|
|
@ -348,7 +348,7 @@ spv_result_t ValidateBinaryUsingContextAndValidationState(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the preconditions involving adjacent instructions. e.g. SpvOpPhi
|
// Validate the preconditions involving adjacent instructions. e.g. SpvOpPhi
|
||||||
// must only be preceeded by SpvOpLabel, SpvOpPhi, or SpvOpLine.
|
// must only be preceded by SpvOpLabel, SpvOpPhi, or SpvOpLine.
|
||||||
if (auto error = ValidateAdjacency(*vstate)) return error;
|
if (auto error = ValidateAdjacency(*vstate)) return error;
|
||||||
|
|
||||||
if (auto error = ValidateEntryPoints(*vstate)) return error;
|
if (auto error = ValidateEntryPoints(*vstate)) return error;
|
||||||
|
|
|
@ -70,7 +70,7 @@ spv_result_t CheckIdDefinitionDominateUse(ValidationState_t& _);
|
||||||
///
|
///
|
||||||
/// This function will iterate over all instructions and check for any required
|
/// This function will iterate over all instructions and check for any required
|
||||||
/// predecessor and/or successor instructions. e.g. SpvOpPhi must only be
|
/// predecessor and/or successor instructions. e.g. SpvOpPhi must only be
|
||||||
/// preceeded by SpvOpLabel, SpvOpPhi, or SpvOpLine.
|
/// preceded by SpvOpLabel, SpvOpPhi, or SpvOpLine.
|
||||||
///
|
///
|
||||||
/// @param[in] _ the validation state of the module
|
/// @param[in] _ the validation state of the module
|
||||||
///
|
///
|
||||||
|
|
|
@ -155,7 +155,7 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) {
|
||||||
first_vector_num_components = num_components;
|
first_vector_num_components = num_components;
|
||||||
} else if (num_components != first_vector_num_components) {
|
} else if (num_components != first_vector_num_components) {
|
||||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||||
<< "Expected operands to have the same number of componenets: "
|
<< "Expected operands to have the same number of components: "
|
||||||
<< spvOpcodeString(opcode);
|
<< spvOpcodeString(opcode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -675,7 +675,7 @@ spv_result_t ValidateStructuredSelections(
|
||||||
} else if (terminator->opcode() == SpvOpSwitch) {
|
} else if (terminator->opcode() == SpvOpSwitch) {
|
||||||
if (!merge) {
|
if (!merge) {
|
||||||
return _.diag(SPV_ERROR_INVALID_CFG, terminator)
|
return _.diag(SPV_ERROR_INVALID_CFG, terminator)
|
||||||
<< "OpSwitch must be preceeded by an OpSelectionMerge "
|
<< "OpSwitch must be preceded by an OpSelectionMerge "
|
||||||
"instruction";
|
"instruction";
|
||||||
}
|
}
|
||||||
// Mark the targets as seen.
|
// Mark the targets as seen.
|
||||||
|
@ -917,7 +917,7 @@ spv_result_t PerformCfgChecks(ValidationState_t& _) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If we have structed control flow, check that no block has a control
|
// If we have structured control flow, check that no block has a control
|
||||||
// flow nesting depth larger than the limit.
|
// flow nesting depth larger than the limit.
|
||||||
if (_.HasCapability(SpvCapabilityShader)) {
|
if (_.HasCapability(SpvCapabilityShader)) {
|
||||||
const int control_flow_nesting_depth_limit =
|
const int control_flow_nesting_depth_limit =
|
||||||
|
|
|
@ -465,7 +465,7 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str,
|
||||||
return lhs.offset < rhs.offset;
|
return lhs.offset < rhs.offset;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Now scan from lowest offest to highest offset.
|
// Now scan from lowest offset to highest offset.
|
||||||
uint32_t nextValidOffset = 0;
|
uint32_t nextValidOffset = 0;
|
||||||
for (size_t ordered_member_idx = 0;
|
for (size_t ordered_member_idx = 0;
|
||||||
ordered_member_idx < member_offsets.size(); ordered_member_idx++) {
|
ordered_member_idx < member_offsets.size(); ordered_member_idx++) {
|
||||||
|
@ -720,7 +720,7 @@ spv_result_t CheckBuiltInVariable(uint32_t var_id, ValidationState_t& vstate) {
|
||||||
return SPV_SUCCESS;
|
return SPV_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks whether proper decorations have been appied to the entry points.
|
// Checks whether proper decorations have been applied to the entry points.
|
||||||
spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) {
|
spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) {
|
||||||
for (uint32_t entry_point : vstate.entry_points()) {
|
for (uint32_t entry_point : vstate.entry_points()) {
|
||||||
const auto& descs = vstate.entry_point_descriptions(entry_point);
|
const auto& descs = vstate.entry_point_descriptions(entry_point);
|
||||||
|
|
|
@ -129,7 +129,7 @@ spv_result_t ValidateUint32ConstantOperandForDebugInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
// True if the operand of a debug info instruction |inst| at |word_index|
|
// True if the operand of a debug info instruction |inst| at |word_index|
|
||||||
// satisifies |expectation| that is given as a function. Otherwise,
|
// satisfies |expectation| that is given as a function. Otherwise,
|
||||||
// returns false.
|
// returns false.
|
||||||
bool DoesDebugInfoOperandMatchExpectation(
|
bool DoesDebugInfoOperandMatchExpectation(
|
||||||
const ValidationState_t& _,
|
const ValidationState_t& _,
|
||||||
|
|
|
@ -502,7 +502,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _,
|
||||||
if (!_.IsIntVectorType(component_type) ||
|
if (!_.IsIntVectorType(component_type) ||
|
||||||
_.GetDimension(component_type) != 2) {
|
_.GetDimension(component_type) != 2) {
|
||||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||||
<< "Expected Image Operand ConstOffsets array componenets to be "
|
<< "Expected Image Operand ConstOffsets array components to be "
|
||||||
"int vectors of size 2";
|
"int vectors of size 2";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1043,7 +1043,7 @@ spv_result_t ValidateSampledImage(ValidationState_t& _,
|
||||||
<< "Result <id> from OpSampledImage instruction must not appear "
|
<< "Result <id> from OpSampledImage instruction must not appear "
|
||||||
"as operand for Op"
|
"as operand for Op"
|
||||||
<< spvOpcodeString(static_cast<SpvOp>(consumer_opcode))
|
<< spvOpcodeString(static_cast<SpvOp>(consumer_opcode))
|
||||||
<< ", since it is not specificed as taking an "
|
<< ", since it is not specified as taking an "
|
||||||
<< "OpTypeSampledImage."
|
<< "OpTypeSampledImage."
|
||||||
<< " Found result <id> '" << _.getIdName(inst->id())
|
<< " Found result <id> '" << _.getIdName(inst->id())
|
||||||
<< "' as an operand of <id> '"
|
<< "' as an operand of <id> '"
|
||||||
|
@ -1672,7 +1672,7 @@ spv_result_t ValidateImageWrite(ValidationState_t& _, const Instruction* inst) {
|
||||||
<< " components, but given only " << actual_coord_size;
|
<< " components, but given only " << actual_coord_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(atgoo@github.com) The spec doesn't explicitely say what the type
|
// TODO(atgoo@github.com) The spec doesn't explicitly say what the type
|
||||||
// of texel should be.
|
// of texel should be.
|
||||||
const uint32_t texel_type = _.GetOperandTypeId(inst, 2);
|
const uint32_t texel_type = _.GetOperandTypeId(inst, 2);
|
||||||
if (!_.IsIntScalarOrVectorType(texel_type) &&
|
if (!_.IsIntScalarOrVectorType(texel_type) &&
|
||||||
|
|
|
@ -297,7 +297,7 @@ spv_result_t VersionCheck(ValidationState_t& _, const Instruction* inst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpTerminateInvocation is special because it is enabled by Shader
|
// OpTerminateInvocation is special because it is enabled by Shader
|
||||||
// capability, but also requries a extension and/or version check.
|
// capability, but also requires an extension and/or version check.
|
||||||
const bool capability_check_is_sufficient =
|
const bool capability_check_is_sufficient =
|
||||||
inst->opcode() != SpvOpTerminateInvocation;
|
inst->opcode() != SpvOpTerminateInvocation;
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ spv_result_t LimitCheckSwitch(ValidationState_t& _, const Instruction* inst) {
|
||||||
// The instruction syntax is as follows:
|
// The instruction syntax is as follows:
|
||||||
// OpSwitch <selector ID> <Default ID> literal label literal label ...
|
// OpSwitch <selector ID> <Default ID> literal label literal label ...
|
||||||
// literal,label pairs come after the first 2 operands.
|
// literal,label pairs come after the first 2 operands.
|
||||||
// It is guaranteed at this point that num_operands is an even numner.
|
// It is guaranteed at this point that num_operands is an even number.
|
||||||
size_t num_pairs = (inst->operands().size() - 2) / 2;
|
size_t num_pairs = (inst->operands().size() - 2) / 2;
|
||||||
const unsigned int num_pairs_limit =
|
const unsigned int num_pairs_limit =
|
||||||
_.options()->universal_limits_.max_switch_branches;
|
_.options()->universal_limits_.max_switch_branches;
|
||||||
|
|
|
@ -225,7 +225,7 @@ spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst,
|
||||||
<< _.VkErrorID(4638) << spvOpcodeString(opcode)
|
<< _.VkErrorID(4638) << spvOpcodeString(opcode)
|
||||||
<< ": in Vulkan environment, Memory Scope cannot be CrossDevice";
|
<< ": in Vulkan environment, Memory Scope cannot be CrossDevice";
|
||||||
}
|
}
|
||||||
// Vulkan 1.0 specifc rules
|
// Vulkan 1.0 specific rules
|
||||||
if (_.context()->target_env == SPV_ENV_VULKAN_1_0 &&
|
if (_.context()->target_env == SPV_ENV_VULKAN_1_0 &&
|
||||||
value != SpvScopeDevice && value != SpvScopeWorkgroup &&
|
value != SpvScopeDevice && value != SpvScopeWorkgroup &&
|
||||||
value != SpvScopeInvocation) {
|
value != SpvScopeInvocation) {
|
||||||
|
@ -234,7 +234,7 @@ spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst,
|
||||||
<< ": in Vulkan 1.0 environment Memory Scope is limited to "
|
<< ": in Vulkan 1.0 environment Memory Scope is limited to "
|
||||||
<< "Device, Workgroup and Invocation";
|
<< "Device, Workgroup and Invocation";
|
||||||
}
|
}
|
||||||
// Vulkan 1.1 specifc rules
|
// Vulkan 1.1 specific rules
|
||||||
if ((_.context()->target_env == SPV_ENV_VULKAN_1_1 ||
|
if ((_.context()->target_env == SPV_ENV_VULKAN_1_1 ||
|
||||||
_.context()->target_env == SPV_ENV_VULKAN_1_2) &&
|
_.context()->target_env == SPV_ENV_VULKAN_1_2) &&
|
||||||
value != SpvScopeDevice && value != SpvScopeWorkgroup &&
|
value != SpvScopeDevice && value != SpvScopeWorkgroup &&
|
||||||
|
|
|
@ -498,7 +498,7 @@ spv_result_t ValidationState_t::RegisterFunctionEnd() {
|
||||||
"inside of another function");
|
"inside of another function");
|
||||||
assert(in_block() == false &&
|
assert(in_block() == false &&
|
||||||
"RegisterFunctionParameter can only be called when parsing the binary "
|
"RegisterFunctionParameter can only be called when parsing the binary "
|
||||||
"ouside of a block");
|
"outside of a block");
|
||||||
current_function().RegisterFunctionEnd();
|
current_function().RegisterFunctionEnd();
|
||||||
in_function_ = false;
|
in_function_ = false;
|
||||||
return SPV_SUCCESS;
|
return SPV_SUCCESS;
|
||||||
|
@ -610,7 +610,7 @@ void ValidationState_t::RegisterStorageClassConsumer(
|
||||||
if (message) {
|
if (message) {
|
||||||
*message =
|
*message =
|
||||||
errorVUID +
|
errorVUID +
|
||||||
"in Vulkan evironment, Output Storage Class must not be "
|
"in Vulkan environment, Output Storage Class must not be "
|
||||||
"used in GLCompute, RayGenerationKHR, IntersectionKHR, "
|
"used in GLCompute, RayGenerationKHR, IntersectionKHR, "
|
||||||
"AnyHitKHR, ClosestHitKHR, MissKHR, or CallableKHR "
|
"AnyHitKHR, ClosestHitKHR, MissKHR, or CallableKHR "
|
||||||
"execution models";
|
"execution models";
|
||||||
|
@ -632,7 +632,7 @@ void ValidationState_t::RegisterStorageClassConsumer(
|
||||||
if (message) {
|
if (message) {
|
||||||
*message =
|
*message =
|
||||||
errorVUID +
|
errorVUID +
|
||||||
"in Vulkan evironment, Workgroup Storage Class is limited "
|
"in Vulkan environment, Workgroup Storage Class is limited "
|
||||||
"to MeshNV, TaskNV, and GLCompute execution model";
|
"to MeshNV, TaskNV, and GLCompute execution model";
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1407,7 +1407,7 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// This large switch case is only searched when an error has occured.
|
// This large switch case is only searched when an error has occurred.
|
||||||
// If an id is changed, the old case must be modified or removed. Each string
|
// If an id is changed, the old case must be modified or removed. Each string
|
||||||
// here is interpreted as being "implemented"
|
// here is interpreted as being "implemented"
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ class ValidationState_t {
|
||||||
bool declare_int16_type = false; // Allow OpTypeInt with 16 bit width?
|
bool declare_int16_type = false; // Allow OpTypeInt with 16 bit width?
|
||||||
bool declare_float16_type = false; // Allow OpTypeFloat with 16 bit width?
|
bool declare_float16_type = false; // Allow OpTypeFloat with 16 bit width?
|
||||||
bool free_fp_rounding_mode = false; // Allow the FPRoundingMode decoration
|
bool free_fp_rounding_mode = false; // Allow the FPRoundingMode decoration
|
||||||
// and its vaules to be used without
|
// and its values to be used without
|
||||||
// requiring any capability
|
// requiring any capability
|
||||||
|
|
||||||
// Allow functionalities enabled by VariablePointers capability.
|
// Allow functionalities enabled by VariablePointers capability.
|
||||||
|
@ -797,7 +797,7 @@ class ValidationState_t {
|
||||||
/// IDs that are entry points, ie, arguments to OpEntryPoint.
|
/// IDs that are entry points, ie, arguments to OpEntryPoint.
|
||||||
std::vector<uint32_t> entry_points_;
|
std::vector<uint32_t> entry_points_;
|
||||||
|
|
||||||
/// Maps an entry point id to its desciptions.
|
/// Maps an entry point id to its descriptions.
|
||||||
std::unordered_map<uint32_t, std::vector<EntryPointDescription>>
|
std::unordered_map<uint32_t, std::vector<EntryPointDescription>>
|
||||||
entry_point_descriptions_;
|
entry_point_descriptions_;
|
||||||
|
|
||||||
|
@ -844,7 +844,7 @@ class ValidationState_t {
|
||||||
// have the same pointer size (for physical pointer types).
|
// have the same pointer size (for physical pointer types).
|
||||||
uint32_t pointer_size_and_alignment_;
|
uint32_t pointer_size_and_alignment_;
|
||||||
|
|
||||||
/// NOTE: See correspoding getter functions
|
/// NOTE: See corresponding getter functions
|
||||||
bool in_function_;
|
bool in_function_;
|
||||||
|
|
||||||
/// The state of optional features. These are determined by capabilities
|
/// The state of optional features. These are determined by capabilities
|
||||||
|
|
|
@ -604,7 +604,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
MakeInstruction(SpvOpNop, {42})}),
|
MakeInstruction(SpvOpNop, {42})}),
|
||||||
"Invalid instruction OpNop starting at word 5: expected "
|
"Invalid instruction OpNop starting at word 5: expected "
|
||||||
"no more operands after 1 words, but stated word count is 2."},
|
"no more operands after 1 words, but stated word count is 2."},
|
||||||
// Supply several more unexpectd words.
|
// Supply several more unexpected words.
|
||||||
{Concatenate({ExpectedHeaderForBound(1),
|
{Concatenate({ExpectedHeaderForBound(1),
|
||||||
MakeInstruction(SpvOpNop, {42, 43, 44, 45, 46, 47})}),
|
MakeInstruction(SpvOpNop, {42, 43, 44, 45, 46, 47})}),
|
||||||
"Invalid instruction OpNop starting at word 5: expected "
|
"Invalid instruction OpNop starting at word 5: expected "
|
||||||
|
|
|
@ -117,7 +117,7 @@ TEST(CInterface, SpecifyConsumerNullDiagnosticForAssembling) {
|
||||||
const spv_position_t& position, const char* message) {
|
const spv_position_t& position, const char* message) {
|
||||||
++invocation;
|
++invocation;
|
||||||
EXPECT_EQ(SPV_MSG_ERROR, level);
|
EXPECT_EQ(SPV_MSG_ERROR, level);
|
||||||
// The error happens at scanning the begining of second line.
|
// The error happens at scanning the beginning of second line.
|
||||||
EXPECT_STREQ("input", source);
|
EXPECT_STREQ("input", source);
|
||||||
EXPECT_EQ(1u, position.line);
|
EXPECT_EQ(1u, position.line);
|
||||||
EXPECT_EQ(0u, position.column);
|
EXPECT_EQ(0u, position.column);
|
||||||
|
|
|
@ -581,7 +581,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
OpenCLDebugInfo100DebugSource, ExtInstCLDebugInfo100RoundTripTest,
|
OpenCLDebugInfo100DebugSource, ExtInstCLDebugInfo100RoundTripTest,
|
||||||
::testing::ValuesIn(std::vector<InstructionCase>({
|
::testing::ValuesIn(std::vector<InstructionCase>({
|
||||||
// TODO(dneto): Should this be a list of sourc texts,
|
// TODO(dneto): Should this be a list of sourc texts,
|
||||||
// to accomodate length limits?
|
// to accommodate length limits?
|
||||||
CASE_I(Source),
|
CASE_I(Source),
|
||||||
CASE_II(Source),
|
CASE_II(Source),
|
||||||
})));
|
})));
|
||||||
|
|
|
@ -233,7 +233,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
CASE3(UMad_hi, u_mad_hi), // enum value 204
|
CASE3(UMad_hi, u_mad_hi), // enum value 204
|
||||||
})));
|
})));
|
||||||
|
|
||||||
// OpenCL.std: 2.3 Common instrucitons
|
// OpenCL.std: 2.3 Common instructions
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
OpenCLCommon, ExtInstOpenCLStdRoundTripTest,
|
OpenCLCommon, ExtInstOpenCLStdRoundTripTest,
|
||||||
::testing::ValuesIn(std::vector<InstructionCase>({
|
::testing::ValuesIn(std::vector<InstructionCase>({
|
||||||
|
|
|
@ -70,7 +70,7 @@ TEST(FuzzerUtilMaybeFindBlockTest, BasicTest) {
|
||||||
ASSERT_TRUE(fuzzerutil::MaybeFindBlock(ir_context, block_id2) != nullptr);
|
ASSERT_TRUE(fuzzerutil::MaybeFindBlock(ir_context, block_id2) != nullptr);
|
||||||
// Block with id 13 cannot be found.
|
// Block with id 13 cannot be found.
|
||||||
ASSERT_FALSE(fuzzerutil::MaybeFindBlock(ir_context, block_id3) != nullptr);
|
ASSERT_FALSE(fuzzerutil::MaybeFindBlock(ir_context, block_id3) != nullptr);
|
||||||
// Block with id 8 exisits but don't not of type OpLabel.
|
// Block with id 8 exists but don't not of type OpLabel.
|
||||||
ASSERT_FALSE(fuzzerutil::MaybeFindBlock(ir_context, block_id4) != nullptr);
|
ASSERT_FALSE(fuzzerutil::MaybeFindBlock(ir_context, block_id4) != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -965,7 +965,7 @@ TEST(FuzzerutilTest, FuzzerUtilMaybeGetPointerTypeTest) {
|
||||||
ASSERT_EQ(
|
ASSERT_EQ(
|
||||||
91, fuzzerutil::MaybeGetPointerType(ir_context, 90, input_storage_class));
|
91, fuzzerutil::MaybeGetPointerType(ir_context, 90, input_storage_class));
|
||||||
|
|
||||||
// A pointer with id=91 and pointee type 90 exisits, but the type should be
|
// A pointer with id=91 and pointee type 90 exists, but the type should be
|
||||||
// input.
|
// input.
|
||||||
ASSERT_EQ(0, fuzzerutil::MaybeGetPointerType(ir_context, 90,
|
ASSERT_EQ(0, fuzzerutil::MaybeGetPointerType(ir_context, 90,
|
||||||
function_storage_class));
|
function_storage_class));
|
||||||
|
|
|
@ -367,7 +367,7 @@ TEST(TransformationAddParameterTest, NonPointerNotApplicableTest) {
|
||||||
transformation_bad_3.IsApplicable(context.get(), transformation_context));
|
transformation_bad_3.IsApplicable(context.get(), transformation_context));
|
||||||
|
|
||||||
// Function with id 14 does not have any callers.
|
// Function with id 14 does not have any callers.
|
||||||
// Bad: Id 18 is not a vaild type.
|
// Bad: Id 18 is not a valid type.
|
||||||
TransformationAddParameter transformation_bad_4(14, 50, 18, {{}}, 51);
|
TransformationAddParameter transformation_bad_4(14, 50, 18, {{}}, 51);
|
||||||
ASSERT_FALSE(
|
ASSERT_FALSE(
|
||||||
transformation_bad_4.IsApplicable(context.get(), transformation_context));
|
transformation_bad_4.IsApplicable(context.get(), transformation_context));
|
||||||
|
|
|
@ -87,7 +87,7 @@ TEST(TransformationAddTypeIntTest, IsApplicable) {
|
||||||
transformation.IsApplicable(context.get(), transformation_context));
|
transformation.IsApplicable(context.get(), transformation_context));
|
||||||
|
|
||||||
// By default SPIR-V does not support 16-bit integers.
|
// By default SPIR-V does not support 16-bit integers.
|
||||||
// Below we add such capability, so the test should now be succesful.
|
// Below we add such capability, so the test should now be successful.
|
||||||
context.get()->get_feature_mgr()->AddCapability(SpvCapabilityInt16);
|
context.get()->get_feature_mgr()->AddCapability(SpvCapabilityInt16);
|
||||||
ASSERT_TRUE(TransformationAddTypeInt(7, 16, true)
|
ASSERT_TRUE(TransformationAddTypeInt(7, 16, true)
|
||||||
.IsApplicable(context.get(), transformation_context));
|
.IsApplicable(context.get(), transformation_context));
|
||||||
|
|
|
@ -106,7 +106,7 @@ TEST(TransformationAdjustBranchWeightsTest, IsApplicableTest) {
|
||||||
kConsoleMessageConsumer));
|
kConsoleMessageConsumer));
|
||||||
TransformationContext transformation_context(
|
TransformationContext transformation_context(
|
||||||
MakeUnique<FactManager>(context.get()), validator_options);
|
MakeUnique<FactManager>(context.get()), validator_options);
|
||||||
// Tests OpBranchConditional instruction with weigths.
|
// Tests OpBranchConditional instruction with weights.
|
||||||
auto instruction_descriptor =
|
auto instruction_descriptor =
|
||||||
MakeInstructionDescriptor(33, SpvOpBranchConditional, 0);
|
MakeInstructionDescriptor(33, SpvOpBranchConditional, 0);
|
||||||
auto transformation =
|
auto transformation =
|
||||||
|
|
|
@ -1343,7 +1343,7 @@ struct StreamParseCase {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::ostream& operator<<(std::ostream& os, const StreamParseCase<T>& fspc) {
|
std::ostream& operator<<(std::ostream& os, const StreamParseCase<T>& fspc) {
|
||||||
os << "StreamParseCase(" << fspc.literal
|
os << "StreamParseCase(" << fspc.literal
|
||||||
<< ", expect_succes:" << int(fspc.expect_success) << ","
|
<< ", expect_success:" << int(fspc.expect_success) << ","
|
||||||
<< fspc.expected_suffix << "," << fspc.expected_value << ")";
|
<< fspc.expected_suffix << "," << fspc.expected_value << ")";
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4323,7 +4323,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
},
|
},
|
||||||
|
|
||||||
// Uint vector type spec constants. One vector has all component dead,
|
// Uint vector type spec constants. One vector has all component dead,
|
||||||
// another vector has one dead unsigend integer and one used unsigned
|
// another vector has one dead unsigned integer and one used unsigned
|
||||||
// integer.
|
// integer.
|
||||||
{
|
{
|
||||||
/* .used_consts = */
|
/* .used_consts = */
|
||||||
|
|
|
@ -70,7 +70,7 @@ class AssemblyBuilder {
|
||||||
static const uint32_t SPEC_ID_BASE = 200;
|
static const uint32_t SPEC_ID_BASE = 200;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Initalize a minimal SPIR-V assembly code as the template. The minimal
|
// Initialize a minimal SPIR-V assembly code as the template. The minimal
|
||||||
// module contains an empty main function and some predefined names for the
|
// module contains an empty main function and some predefined names for the
|
||||||
// main function.
|
// main function.
|
||||||
AssemblyBuilder()
|
AssemblyBuilder()
|
||||||
|
@ -102,7 +102,7 @@ class AssemblyBuilder {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appends OpName instructions to this builder. Instrcution strings that do
|
// Appends OpName instructions to this builder. Instruction strings that do
|
||||||
// not start with 'OpName ' will be skipped. Returns the references of this
|
// not start with 'OpName ' will be skipped. Returns the references of this
|
||||||
// assembly builder.
|
// assembly builder.
|
||||||
AssemblyBuilder& AppendNames(const std::vector<std::string>& vec_asm_code) {
|
AssemblyBuilder& AppendNames(const std::vector<std::string>& vec_asm_code) {
|
||||||
|
|
|
@ -884,7 +884,7 @@ TEST_F(BlockMergeTest, MergeHeaders) {
|
||||||
; CHECK-NEXT: [[header]] = OpLabel
|
; CHECK-NEXT: [[header]] = OpLabel
|
||||||
; CHECK-NEXT: OpSelectionMerge [[merge:%\w+]]
|
; CHECK-NEXT: OpSelectionMerge [[merge:%\w+]]
|
||||||
; CHECK: [[merge]] = OpLabel
|
; CHECK: [[merge]] = OpLabel
|
||||||
; CHEKC: OpReturn
|
; CHECK: OpReturn
|
||||||
OpCapability Shader
|
OpCapability Shader
|
||||||
OpMemoryModel Logical GLSL450
|
OpMemoryModel Logical GLSL450
|
||||||
OpEntryPoint Fragment %func "func"
|
OpEntryPoint Fragment %func "func"
|
||||||
|
|
|
@ -378,7 +378,7 @@ TEST_F(CodeSinkTest, MoveReadOnlyLoadWithSync) {
|
||||||
%uint = OpTypeInt 32 0
|
%uint = OpTypeInt 32 0
|
||||||
%uint_0 = OpConstant %uint 0
|
%uint_0 = OpConstant %uint 0
|
||||||
%uint_4 = OpConstant %uint 4
|
%uint_4 = OpConstant %uint 4
|
||||||
%mem_semantics = OpConstant %uint 0x42 ; Uniform memeory arquire
|
%mem_semantics = OpConstant %uint 0x42 ; Uniform memory arquire
|
||||||
%_arr_uint_uint_4 = OpTypeArray %uint %uint_4
|
%_arr_uint_uint_4 = OpTypeArray %uint %uint_4
|
||||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||||
%_ptr_Uniform__arr_uint_uint_4 = OpTypePointer Uniform %_arr_uint_uint_4
|
%_ptr_Uniform__arr_uint_uint_4 = OpTypePointer Uniform %_arr_uint_uint_4
|
||||||
|
@ -419,7 +419,7 @@ TEST_F(CodeSinkTest, DontMoveBecauseOfSync) {
|
||||||
%uint = OpTypeInt 32 0
|
%uint = OpTypeInt 32 0
|
||||||
%uint_0 = OpConstant %uint 0
|
%uint_0 = OpConstant %uint 0
|
||||||
%uint_4 = OpConstant %uint 4
|
%uint_4 = OpConstant %uint 4
|
||||||
%mem_semantics = OpConstant %uint 0x42 ; Uniform memeory arquire
|
%mem_semantics = OpConstant %uint 0x42 ; Uniform memory arquire
|
||||||
%_arr_uint_uint_4 = OpTypeStruct %uint
|
%_arr_uint_uint_4 = OpTypeStruct %uint
|
||||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||||
%_ptr_Uniform__arr_uint_uint_4 = OpTypePointer Uniform %_arr_uint_uint_4
|
%_ptr_Uniform__arr_uint_uint_4 = OpTypePointer Uniform %_arr_uint_uint_4
|
||||||
|
@ -460,7 +460,7 @@ TEST_F(CodeSinkTest, DontMoveBecauseOfAtomicWithSync) {
|
||||||
%uint = OpTypeInt 32 0
|
%uint = OpTypeInt 32 0
|
||||||
%uint_0 = OpConstant %uint 0
|
%uint_0 = OpConstant %uint 0
|
||||||
%uint_4 = OpConstant %uint 4
|
%uint_4 = OpConstant %uint 4
|
||||||
%mem_semantics = OpConstant %uint 0x42 ; Uniform memeory arquire
|
%mem_semantics = OpConstant %uint 0x42 ; Uniform memory arquire
|
||||||
%_arr_uint_uint_4 = OpTypeStruct %uint
|
%_arr_uint_uint_4 = OpTypeStruct %uint
|
||||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||||
%_ptr_Uniform__arr_uint_uint_4 = OpTypePointer Uniform %_arr_uint_uint_4
|
%_ptr_Uniform__arr_uint_uint_4 = OpTypePointer Uniform %_arr_uint_uint_4
|
||||||
|
|
|
@ -1613,7 +1613,7 @@ OpBranch %7
|
||||||
%11 = OpLogicalOr %bool %true %false
|
%11 = OpLogicalOr %bool %true %false
|
||||||
OpBranch %7
|
OpBranch %7
|
||||||
%7 = OpLabel
|
%7 = OpLabel
|
||||||
; This phi is in a block preceeding the merge %14!
|
; This phi is in a block preceding the merge %14!
|
||||||
%8 = OpPhi %bool %10 %5 %11 %6
|
%8 = OpPhi %bool %10 %5 %11 %6
|
||||||
OpBranch %14
|
OpBranch %14
|
||||||
%14 = OpLabel
|
%14 = OpLabel
|
||||||
|
|
|
@ -118,7 +118,7 @@ class DecorationManagerTest : public ::testing::Test {
|
||||||
TEST_F(DecorationManagerTest,
|
TEST_F(DecorationManagerTest,
|
||||||
ComparingDecorationsWithDiffOpcodesDecorateDecorateId) {
|
ComparingDecorationsWithDiffOpcodesDecorateDecorateId) {
|
||||||
IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer());
|
IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer());
|
||||||
// This parameter can be interprated both as { SpvDecorationConstant }
|
// This parameter can be interpreted both as { SpvDecorationConstant }
|
||||||
// and also as a list of IDs: { 22 }
|
// and also as a list of IDs: { 22 }
|
||||||
const std::vector<uint32_t> param{SpvDecorationConstant};
|
const std::vector<uint32_t> param{SpvDecorationConstant};
|
||||||
// OpDecorate %1 Constant
|
// OpDecorate %1 Constant
|
||||||
|
@ -137,7 +137,7 @@ TEST_F(DecorationManagerTest,
|
||||||
TEST_F(DecorationManagerTest,
|
TEST_F(DecorationManagerTest,
|
||||||
ComparingDecorationsWithDiffOpcodesDecorateDecorateString) {
|
ComparingDecorationsWithDiffOpcodesDecorateDecorateString) {
|
||||||
IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer());
|
IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer());
|
||||||
// This parameter can be interprated both as { SpvDecorationConstant }
|
// This parameter can be interpreted both as { SpvDecorationConstant }
|
||||||
// and also as a null-terminated string with a single character with value 22.
|
// and also as a null-terminated string with a single character with value 22.
|
||||||
const std::vector<uint32_t> param{SpvDecorationConstant};
|
const std::vector<uint32_t> param{SpvDecorationConstant};
|
||||||
// OpDecorate %1 Constant
|
// OpDecorate %1 Constant
|
||||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче