[Openmp-commits] [PATCH] D140213: [OpenMP][libomptarget] Add missing symbols in dynamic_hsa

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Dec 16 06:49:08 PST 2022


jhuber6 added a subscriber: JonChesterfield.
jhuber6 added inline comments.


================
Comment at: openmp/libomptarget/plugins/amdgpu/dynamic_hsa/hsa.h:306
+  HSA_DEFAULT_FLOAT_ROUNDING_MODE_NEAR = 2,
+} hsa_default_float_rounding_mode_t;
+
----------------
arsenm wrote:
> kevinsala wrote:
> > jhuber6 wrote:
> > > arsenm wrote:
> > > > Is there a reason this is missing one?
> > > ```
> > > typedef enum {                                                                                                                                                                                                    
> > >   /**                                                                                                                                                                                                             
> > >    * Use a default floating-point rounding mode specified elsewhere.                                                                                                                                              
> > >    */                                                                                                                                                                                                             
> > >   HSA_DEFAULT_FLOAT_ROUNDING_MODE_DEFAULT = 0,    
> > >   /**                                                                                                                                                                                                             
> > >    * Operations that specify the default floating-point mode are rounded to zero                                                                                                                                  
> > >    * by default.                                                                                                                                                                                                  
> > >    */                                                                                                                                                                                                             
> > >   HSA_DEFAULT_FLOAT_ROUNDING_MODE_ZERO = 1,                                                                                                                                                                       
> > >   /**                                                                                                                                                                                                             
> > >    * Operations that specify the default floating-point mode are rounded to the                                                                                                                                   
> > >    * nearest representable number and that ties should be broken by selecting                                                                                                                                     
> > >    * the value with an even least significant bit.                                                                                                                                                                
> > >    */                                                                                                                                                                                                             
> > >   HSA_DEFAULT_FLOAT_ROUNDING_MODE_NEAR = 2                                                                                                                                                                        
> > > } hsa_default_float_rounding_mode_t;
> > > ```
> > > That's all I see in my installation, unless this was changed recently.
> > That's used in https://reviews.llvm.org/D138389
> There are 4 IEEE rounding modes and the hardware supports all of them so this is suspicious. Also "default" = near, so really this is missing +/- infinity
That's a good point, Clang defined the following, which matches what I just looked up at https://en.wikipedia.org/wiki/IEEE_754#Rounding_rules.
```
  TowardZero        = 0,    ///< roundTowardZero.                                                                                                                                     
  NearestTiesToEven = 1,    ///< roundTiesToEven.                                                                                                                                           
  TowardPositive    = 2,    ///< roundTowardPositive.                                                                                                                      
  TowardNegative    = 3,    ///< roundTowardNegative.                                                                                                          
  NearestTiesToAway = 4,    ///< roundTiesToAway.
```

These three are all that's included in `hsa.h` for when we load the executable, not sure who would be the person to bring that up to, maybe @JonChesterfield has an idea. Maybe they're combining the  +/- and nearest rounding modes somehow.

 In any case this is unrelated to this patch as it just copied what `hsa.h` gives it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140213/new/

https://reviews.llvm.org/D140213



More information about the Openmp-commits mailing list