File tree Expand file tree Collapse file tree
20_matrixexperiments-bf16
20_matrixexperiments-tf32 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010
1111#include < algorithm>
1212#include < chrono>
13+ #include < iostream>
1314#include < sstream>
1415#include < string>
1516#include < random>
@@ -68,18 +69,23 @@ std::string makeTestName(
6869
6970static size_t findMinSubGroupSize (cl::Device& device)
7071{
71- auto s = device.getInfo <CL_DEVICE_SUB_GROUP_SIZES_INTEL >();
72- auto it = std::min_element (std::begin (s), std::end (s));
73- if (it != std::end (s)) {
74- return *it;
72+ if (checkDeviceForExtension (device, CL_INTEL_REQUIRED_SUBGROUP_SIZE_EXTENSION_NAME )) {
73+ auto s = device.getInfo <CL_DEVICE_SUB_GROUP_SIZES_INTEL >();
74+ auto it = std::min_element (std::begin (s), std::end (s));
75+ if (it != std::end (s)) {
76+ return *it;
77+ }
7578 }
7679 return 0 ;
7780}
7881
7982static bool supportsSubgroupSize (cl::Device& device, size_t subgroupSize)
8083{
81- auto s = device.getInfo <CL_DEVICE_SUB_GROUP_SIZES_INTEL >();
82- return std::find (std::begin (s), std::end (s), subgroupSize) != std::end (s);
84+ if (checkDeviceForExtension (device, CL_INTEL_REQUIRED_SUBGROUP_SIZE_EXTENSION_NAME )) {
85+ auto s = device.getInfo <CL_DEVICE_SUB_GROUP_SIZES_INTEL >();
86+ return std::find (std::begin (s), std::end (s), subgroupSize) != std::end (s);
87+ }
88+ return false ;
8389}
8490
8591static void setRoundRobin (cl::Kernel& kernel)
Original file line number Diff line number Diff line change @@ -61,8 +61,8 @@ float8 activation(float8 f)
6161#ifndef __has_builtin
6262#define __has_builtin (x ) 0
6363#endif
64- #if __has_builtin (__builtin_expect ) == 0
65- #define __builtin_expect (x )
64+ #if __has_builtin (__builtin_assume ) == 0
65+ #define __builtin_assume (x )
6666#endif
6767
6868#if defined(cl_intel_subgroups ) && defined(cl_intel_subgroups_short )
Original file line number Diff line number Diff line change 1010
1111#include < algorithm>
1212#include < chrono>
13- #include < cstdint >
13+ #include < iostream >
1414#include < sstream>
1515#include < string>
1616#include < random>
@@ -68,18 +68,23 @@ std::string makeTestName(
6868
6969static size_t findMinSubGroupSize (cl::Device& device)
7070{
71- auto s = device.getInfo <CL_DEVICE_SUB_GROUP_SIZES_INTEL >();
72- auto it = std::min_element (std::begin (s), std::end (s));
73- if (it != std::end (s)) {
74- return *it;
71+ if (checkDeviceForExtension (device, CL_INTEL_REQUIRED_SUBGROUP_SIZE_EXTENSION_NAME )) {
72+ auto s = device.getInfo <CL_DEVICE_SUB_GROUP_SIZES_INTEL >();
73+ auto it = std::min_element (std::begin (s), std::end (s));
74+ if (it != std::end (s)) {
75+ return *it;
76+ }
7577 }
7678 return 0 ;
7779}
7880
7981static bool supportsSubgroupSize (cl::Device& device, size_t subgroupSize)
8082{
81- auto s = device.getInfo <CL_DEVICE_SUB_GROUP_SIZES_INTEL >();
82- return std::find (std::begin (s), std::end (s), subgroupSize) != std::end (s);
83+ if (checkDeviceForExtension (device, CL_INTEL_REQUIRED_SUBGROUP_SIZE_EXTENSION_NAME )) {
84+ auto s = device.getInfo <CL_DEVICE_SUB_GROUP_SIZES_INTEL >();
85+ return std::find (std::begin (s), std::end (s), subgroupSize) != std::end (s);
86+ }
87+ return false ;
8388}
8489
8590static void setRoundRobin (cl::Kernel& kernel)
Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ int8 activation(int8 i)
5252#ifndef __has_builtin
5353#define __has_builtin (x ) 0
5454#endif
55- #if __has_builtin (__builtin_expect ) == 0
56- #define __builtin_expect (x )
55+ #if __has_builtin (__builtin_assume ) == 0
56+ #define __builtin_assume (x )
5757#endif
5858
5959#if defined(__opencl_c_integer_dot_product_input_4x8bit_packed )
Original file line number Diff line number Diff line change 1010
1111#include < algorithm>
1212#include < chrono>
13- #include < cmath>
14- #include < limits>
13+ #include < iostream>
1514#include < sstream>
1615#include < string>
1716#include < random>
@@ -69,10 +68,12 @@ std::string makeTestName(
6968
7069static size_t findMinSubGroupSize (cl::Device& device)
7170{
72- auto s = device.getInfo <CL_DEVICE_SUB_GROUP_SIZES_INTEL >();
73- auto it = std::min_element (std::begin (s), std::end (s));
74- if (it != std::end (s)) {
75- return *it;
71+ if (checkDeviceForExtension (device, CL_INTEL_REQUIRED_SUBGROUP_SIZE_EXTENSION_NAME )) {
72+ auto s = device.getInfo <CL_DEVICE_SUB_GROUP_SIZES_INTEL >();
73+ auto it = std::min_element (std::begin (s), std::end (s));
74+ if (it != std::end (s)) {
75+ return *it;
76+ }
7677 }
7778 return 0 ;
7879}
Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ float8 activation(float8 f)
5252#ifndef __has_builtin
5353#define __has_builtin (x ) 0
5454#endif
55- #if __has_builtin (__builtin_expect ) == 0
56- #define __builtin_expect (x )
55+ #if __has_builtin (__builtin_assume ) == 0
56+ #define __builtin_assume (x )
5757#endif
5858
5959#if defined(cl_intel_subgroups )
You can’t perform that action at this time.
0 commit comments