Skip to content

Indexing range metadata is set up wrong #3024

@eschnett

Description

@eschnett

The file indexing.jl contains the lines

            # attach range metadata
            range_metadata = MDNode([ConstantInt(Int32(range.start)),
                                     ConstantInt(Int32(range.stop))])
            metadata(idx)[LLVM.MD_range] = range_metadata

LLVM range metadata https://llvm.org/docs/LangRef.html#range-metadata are described by a half-open interval, as is common in C++. Thus range.stop needs to be range.stop + 1 in the code above.

This error leads to weird code generation problems when checking block or grid sizes just below the maximum possible.

(Having the lower bound there is a good idea. I am not sure about the upper bounds as they may increase in newer architectures, and without updating the bounds here we would generate wrong code for these architectures.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions