Dxsa mlir dcl constant buffer and other ops#133
Conversation
| return builder.buildDclOutput(*operand, loc); | ||
| } | ||
|
|
||
| FailureOr<Instruction> parseDclConstantBuffer(uint32_t opcodeToken, |
There was a problem hiding this comment.
For Shader Model 5.1 and later, constant buffer opcode is followed by 3 operands: range, size and index.
Looks like we only handle Shader Model 4.0 through 5.0.
| if (!accessPattern) | ||
| return emitError(loc, "unknown constant buffer access pattern: ") | ||
| << rawAccessPattern; | ||
| auto operand = parseInlineOperand(); |
There was a problem hiding this comment.
The operand for dcl_constantBuffer is fake - it can only be D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER, and we only need indices from it. The second index is also fake: it defines size of a buffer. Other properties of operands are meaningless - components, mask, swizzle. I don't think they are used for this instruction.
| LogicalResult | ||
| InlineOperandAttr::verify(function_ref<InFlightDiagnostic()> emitError, | ||
| ::mlir::dxsa::InlineOperandType /*type*/, | ||
| uint32_t components, |
There was a problem hiding this comment.
Do we verify that components can only be 0, 1, or 4?
| ctx, static_cast<dxsa::ComponentName>(comp.swizzle[0]), | ||
| static_cast<dxsa::ComponentName>(comp.swizzle[1]), | ||
| static_cast<dxsa::ComponentName>(comp.swizzle[2]), | ||
| static_cast<dxsa::ComponentName>(comp.swizzle[3])); |
There was a problem hiding this comment.
Can we use symbolize to verify range?
| def DXSA_SystemValueNameAttr : | ||
| EnumAttr<DXSADialect, DXSA_SystemValueName, "system_value_name"> { | ||
| let assemblyFormat = "$value"; | ||
| let assemblyFormat = "`<` $value `>`"; |
There was a problem hiding this comment.
Why do we need angle brackets here?
| }]; | ||
| let parameters = (ins | ||
| EnumParameter<DXSA_InlineOperandType>:$type, | ||
| "uint32_t":$components, |
There was a problem hiding this comment.
Why uint32_t and not, say, I32Attr?
…t, dcl_hs_join_phase_instance_count, dcl_hs_max_tessfactor, dcl_index_range, dcl_output_sgv, dcl_output_siv and dcl_tgsm_raw instructions Example: dxsa.dcl_constant_buffer <type = constant_buffer, components = 4, swizzle = <x, y, z, w>, index = [0, 1]>, <immediateIndexed> dxsa.dcl_hs_fork_phase_instance_count 4 dxsa.dcl_hs_join_phase_instance_count 2 dxsa.dcl_hs_max_tessfactor 6.400000e+01 dxsa.dcl_index_range <type = input, components = 4, mask = <x, y, z, w>, index = [4]>, 6 dxsa.dcl_output_sgv <type = output, components = 4, mask = <x>, index = [0]>, <primitiveID> dxsa.dcl_output_siv <type = output, components = 4, mask = <x, y, z, w>, index = [0]>, <position> dxsa.dcl_tgsm_raw <type = thread_group_shared_memory, components = 0, index = [0]>, 1024 Signed-off-by: Vladimir Shiryaev <tagolog@users.noreply.github.com>
f593309 to
62108d3
Compare
No description provided.