Skip to content

DXIL Validator doesn't notice obviously bad indices in the createHandleFromBinding op #7019

Closed

Description

@bogner

Description
Giving the CreateHandle operation an index that is less-than the binding lower bound fails validation:

Function: main: error: Constant values must be in-range for operation.
note: at '%0 = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 1, i32 1, i32 0, i1 false)' in block 'entry' of function 'main'.

However, this passes the validator if we have the same error but are using DXIL 1.6+'s CreateHandleFromBinding.

Steps to Reproduce
Craft a resource binding with a lower bound greater than zero and then index it at 0.

; call has binding info starting at 1 but index at 0:
call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 1, i32 1, i32 4, i8 1 }, i32 0, i1 false)
; metadata for the same binding:
!{i32 1, %"class.RWBuffer<vector<float, 4> >"* undef, !"", i32 4, i32 1, i32 1, i32 10, i1 false, i1 false, i1 false, !7}

Environment

  • DXC version: dxcompiler.dll: 1.8 - 1.8.0.14766 (main, ac36a79); dxil.dll: 1.8(1.8.0.14766)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugvalidation

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions