Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

AMDGPU mishandles canonicalize with ieee mode disabled #139622

Copy link
Copy link
Open
@arsenm

Description

@arsenm
Issue body actions

With the IEEE mode bit disabled (i.e. shaders or any function with the "amdgpu-ieee"="false" attribute, the canonicalize intrinsic is not implemented correctly. No floating point instruction will quiet a signaling nan in this mode. We need to do something else to ensure a signaling nan is quieted.

; llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 < %s | FileCheck -check-prefix=GFX8 %s
; llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 < %s | FileCheck -check-prefix=GFX9 %s

; These do not quiet with ieee=0
; GFX8 v_mul_f32_e32 v0, 1.0, v0
; GFX9: v_max_f32_e32 v0, v0, v0
define float @canonicalize(float %x) "amdgpu-ieee"="false" {
  %result = call float @llvm.canonicalize.f32(float %x)
  ret float %result
}

; For gfx9 (and gfx8 without daz/ftz), maybe can do this:
; s_mov_b32 s4, 0x7fc00000
; v_max_f32_e64 v0, v0, s4

; The documentation pseudocode suggests this is biased to return src1
; if src0 is a nan.

; For gfx8, this will still not flush if daz/ftz is enabled. Probably
; need to do both:
; s_mov_b32 s4, 0x7fc00000
; v_max_f32_e64 v0, v0, s4
; v_mul_f32_e32 v0, 1.0, v0

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.