Skip to content

[NVPTX] Incorrect alignment in call prototype for 'sprintf' function #100055

@jhuber6

Description

@jhuber6

The NVPTX backend currently emits the incorrect alignment when trying to compile the sprintf function with LTO. It will emit errors like the following:

ptxas a.s, line 1509; error   : Alignment of argument does not match formal parameter '_'

Looking at the IR in https://godbolt.org/z/n9nK6ddxb I noticed that many of these _ function calls come from the main implementation. If this function is internalized, then these calls get an incorrect alignment of 16 as in the following:

prototype_82 : .callprototype (.param .b32 _) _ (.param .align 16 .b8 _[16], .param .b64 _);

If I make the indirect call instead have an alignment of 8, then it works just fine, i.e. This also happens if I manually remove the internal keyword from the function and thus make it .visible.

prototype_82 : .callprototype (.param .b32 _) _ (.param .align 8 .b8 _[16], .param .b64 _);

Any clue why this would cause issues? Since this is an indirect call it's not like there's a set prototype we need to adhere to. And I don't see why making the function .visible or not makes the alignment correct.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions