Skip to content

GPU: Unify usage of half precision float into half_t typedef in GPUCommonMath.h - #16149

Merged
davidrohr merged 1 commit into
AliceO2Group:devfrom
davidrohr:PR
Nov 19, 2026
Merged

davidrohr merged 1 commit into
AliceO2Group:devfrom
davidrohr:PR

Conversation

@davidrohr

Copy link
Copy Markdown
Collaborator

@ChSonnabend : Could you check if that works correctly for your ONNXRuntime code?

@davidrohr
davidrohr requested review from a team and sgorbuno as code owners November 18, 2026 10:41
@davidrohr

Copy link
Copy Markdown
Collaborator Author

@ktf : Could you check the metal changes?

if (IsNegative()) {
return -o.f;
}
#elif __cplusplus >= 202302L && defined(__STDCPP_FLOAT16_T__)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#elif __cplusplus >= 202302L && defined(__STDCPP_FLOAT16_T__)
#if __cplusplus >= 202302L && defined(__STDCPP_FLOAT16_T__)

no?

@ktf

ktf commented Nov 18, 2026

Copy link
Copy Markdown
Member

Apart from the inline comment, everything else is bit-to-bit compatible on metal.

@davidrohr
davidrohr force-pushed the PR branch 2 times, most recently from f5bad33 to 20e707d Compare November 18, 2026 13:49
@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2/fullCI_slc9 for f147c03 at 2026-11-18 16:13:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/Tutorials/ML/benchmarkOnnxModel.cxx:19:10: fatal error: ML/3rdparty/GPUORTFloat16.h: No such file or directory
ninja: build stopped: subcommand failed.


## sw/BUILD/o2checkcode-latest/log
--
========== List of errors found ==========
++ echo 'Found 0 errors and 0 warnings.'
Found 0 errors and 0 warnings.
++ [[ 0 -gt 0 ]]
++ [[ 0 -gt 0 ]]
++ [[ 0 -gt 0 ]]
++ mkdir -p /sw/INSTALLROOT/80eff5f0f77ea9d6e3cb212127adf57f2e5889b8/slc9_x86-64/o2checkcode/1.0-local62/etc/modulefiles
++ alibuild-generate-module
+ HAS_BIN=
+ HAS_LIB=
+ HAS_CMAKE=
+ HAS_ROOT=
+ '[' 0 '!=' 0 ']'
+ cat
+ printf 'if ![ is-loaded '\''BASE/1.0'\'' ] {\n module load BASE/1.0\n}'
+ echo 'BUILD_REQUIRES=CMake alibuild-recipe-tools defaults-release'
BUILD_REQUIRES=CMake alibuild-recipe-tools defaults-release
+ FULL_BUILD_REQUIRES='defaults-release FairCMakeModules UUID safe_int ninja-fortran Alice-GRID-Utils ninja date double-conversion Python-modules-list CMake pytorch_cpuinfo json-c googlebenchmark alibuild-recipe-tools bz2 O2-customization MPFR'
+ echo 'FULL_BUILD_REQUIRES=defaults-release FairCMakeModules UUID safe_int ninja-fortran Alice-GRID-Utils ninja date double-conversion Python-modules-list CMake pytorch_cpuinfo json-c googlebenchmark alibuild-recipe-tools bz2 O2-customization MPFR'
FULL_BUILD_REQUIRES=defaults-release FairCMakeModules UUID safe_int ninja-fortran Alice-GRID-Utils ninja date double-conversion Python-modules-list CMake pytorch_cpuinfo json-c googlebenchmark alibuild-recipe-tools bz2 O2-customization MPFR
++ env
++ cut -f1 -d=
++ grep -v '^DEFAULT_'
++ grep -v PKGREVISION
++ grep -v ALIBUILD_RECIPE_TOOLS
++ grep REVISION
++ sed -e s/_REVISION//
+ for x in $(env | cut -f1 -d= | grep -v "^DEFAULT_" | grep -v PKGREVISION | grep -v ALIBUILD_RECIPE_TOOLS | grep REVISION | sed -e 's/_REVISION//')
++ eval 'echo $LIBFFI_REVISION'
+++ echo 14
+ REVISION_VALUE=14
++ eval 'echo $LIBFFI_VERSION'
+++ echo v3.2.1-alice1
+ VERSION_VALUE=v3.2.1-alice1
++ eval 'echo $LIBFFI_ROOT'
+++ echo /sw/slc9_x86-64/libffi/v3.2.1-alice1-14
+ ROOT_PATH_VALUE=/sw/slc9_x86-64/libffi/v3.2.1-alice1-14
+ '[' -z 14 ']'
+ echo 'defaults-release FairCMakeModules UUID safe_int ninja-fortran Alice-GRID-Utils ninja date double-conversion Python-modules-list CMake pytorch_cpuinfo json-c googlebenchmark alibuild-recipe-tools bz2 O2-customization MPFR'
+ tr '[:lower:]' '[:upper:]'
+ tr - _
+ tr ' ' '\n'
[0 more errors; see full log]

Full log here.

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2/fullCI_slc9 for f5bad33 at 2026-11-18 16:14:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/Tutorials/ML/benchmarkOnnxModel.cxx:207:38: error: request for member 'ToFloat' in '(& halves)->std::vector<_Float16>::operator[](i)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<_Float16>, _Float16>::value_type' {aka '_Float16'}
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/Tutorials/ML/benchmarkOnnxModel.cxx:302:74: error: request for member 'ToFloat' in '*(fp16Data + ((sizetype)(i * 2)))', which is of non-class type 'const _Float16'
ninja: build stopped: subcommand failed.

Full log here.

@alibuild

alibuild commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Error while checking build/O2/fullCI_slc9 for 20e707d at 2026-11-19 00:31:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/Tutorials/ML/benchmarkOnnxModel.cxx:207:38: error: request for member 'ToFloat' in '(& halves)->std::vector<_Float16>::operator[](i)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<_Float16>, _Float16>::value_type' {aka '_Float16'}
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/Tutorials/ML/benchmarkOnnxModel.cxx:302:74: error: request for member 'ToFloat' in '*(fp16Data + ((sizetype)(i * 2)))', which is of non-class type 'const _Float16'
ninja: build stopped: subcommand failed.


## sw/BUILD/o2checkcode-latest/log
--
========== List of errors found ==========
++ echo 'Found 0 errors and 0 warnings.'
Found 0 errors and 0 warnings.
++ [[ 0 -gt 0 ]]
++ [[ 0 -gt 0 ]]
++ [[ 0 -gt 0 ]]
++ mkdir -p /sw/INSTALLROOT/cb3ce8b0690061302a4dbd1d8db595b82aef133f/slc9_x86-64/o2checkcode/1.0-local2/etc/modulefiles
++ alibuild-generate-module
+ HAS_BIN=
+ HAS_LIB=
+ HAS_CMAKE=
+ HAS_ROOT=
+ '[' 0 '!=' 0 ']'
+ cat
+ printf 'if ![ is-loaded '\''BASE/1.0'\'' ] {\n module load BASE/1.0\n}'
+ echo 'BUILD_REQUIRES=CMake alibuild-recipe-tools defaults-release'
BUILD_REQUIRES=CMake alibuild-recipe-tools defaults-release
+ FULL_BUILD_REQUIRES='MPFR alibuild-recipe-tools googlebenchmark Alice-GRID-Utils defaults-release ninja-fortran Python-modules-list UUID ninja bz2 pytorch_cpuinfo CMake safe_int json-c date FairCMakeModules double-conversion O2-customization'
+ echo 'FULL_BUILD_REQUIRES=MPFR alibuild-recipe-tools googlebenchmark Alice-GRID-Utils defaults-release ninja-fortran Python-modules-list UUID ninja bz2 pytorch_cpuinfo CMake safe_int json-c date FairCMakeModules double-conversion O2-customization'
FULL_BUILD_REQUIRES=MPFR alibuild-recipe-tools googlebenchmark Alice-GRID-Utils defaults-release ninja-fortran Python-modules-list UUID ninja bz2 pytorch_cpuinfo CMake safe_int json-c date FairCMakeModules double-conversion O2-customization
++ env
++ cut -f1 -d=
++ grep -v '^DEFAULT_'
++ grep -v PKGREVISION
++ grep -v ALIBUILD_RECIPE_TOOLS
++ grep REVISION
++ sed -e s/_REVISION//
+ for x in $(env | cut -f1 -d= | grep -v "^DEFAULT_" | grep -v PKGREVISION | grep -v ALIBUILD_RECIPE_TOOLS | grep REVISION | sed -e 's/_REVISION//')
++ eval 'echo $LIBFFI_REVISION'
+++ echo 14
+ REVISION_VALUE=14
++ eval 'echo $LIBFFI_VERSION'
+++ echo v3.2.1-alice1
+ VERSION_VALUE=v3.2.1-alice1
++ eval 'echo $LIBFFI_ROOT'
+++ echo /sw/slc9_x86-64/libffi/v3.2.1-alice1-14
+ ROOT_PATH_VALUE=/sw/slc9_x86-64/libffi/v3.2.1-alice1-14
+ '[' -z 14 ']'
+ echo 'MPFR alibuild-recipe-tools googlebenchmark Alice-GRID-Utils defaults-release ninja-fortran Python-modules-list UUID ninja bz2 pytorch_cpuinfo CMake safe_int json-c date FairCMakeModules double-conversion O2-customization'
+ tr '[:lower:]' '[:upper:]'
+ tr - _
[0 more errors; see full log]

Full log here.

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2/fullCI_slc9 for 264f8c4 at 2026-11-18 23:39:

No log files found

Full log here.

@davidrohr
davidrohr merged commit 08d05b4 into AliceO2Group:dev Nov 19, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants