|
16 | 16 | #include <Framework/ProcessingContext.h> |
17 | 17 | #include <Framework/runDataProcessing.h> |
18 | 18 |
|
19 | | -#include <ML/3rdparty/GPUORTFloat16.h> |
20 | 19 | #include <onnxruntime_c_api.h> |
21 | 20 | #include <onnxruntime_cxx_api.h> |
22 | 21 |
|
@@ -196,15 +195,15 @@ struct BenchmarkOnnxModel { |
196 | 195 | // File loading and FP16 conversion are outside the timing loop. Without a |
197 | 196 | // file, retain deterministic synthetic inputs for performance-only runs. |
198 | 197 | std::vector<float> floats(fp16.value ? 0 : count); |
199 | | - std::vector<o2::OrtDataType::Float16_t> halves(fp16.value ? count : 0); |
200 | | - static_assert(sizeof(o2::OrtDataType::Float16_t) == 2); |
| 198 | + std::vector<_Float16> halves(fp16.value ? count : 0); |
| 199 | + static_assert(sizeof(_Float16) == 2); |
201 | 200 | auto store = [&](size_t i, float value) { |
202 | 201 | if (!std::isfinite(value)) { |
203 | 202 | throw std::runtime_error("Input features must be finite"); |
204 | 203 | } |
205 | 204 | if (fp16.value) { |
206 | | - halves[i] = o2::OrtDataType::Float16_t(value); |
207 | | - if (!std::isfinite(halves[i].ToFloat())) { |
| 205 | + halves[i] = _Float16(value); |
| 206 | + if (!std::isfinite((float)halves[i])) { |
208 | 207 | throw std::runtime_error("Input feature overflows FP16"); |
209 | 208 | } |
210 | 209 | } else { |
@@ -295,11 +294,11 @@ struct BenchmarkOnnxModel { |
295 | 294 | throw std::runtime_error("Prediction export requires an FP32 or FP16 first output [batch-size, classes]"); |
296 | 295 | } |
297 | 296 | const float* fp32 = outputType == ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT ? output.GetTensorData<float>() : nullptr; |
298 | | - const auto* fp16Data = outputType == ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16 ? output.GetTensorData<o2::OrtDataType::Float16_t>() : nullptr; |
| 297 | + const auto* fp16Data = outputType == ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16 ? output.GetTensorData<_Float16>() : nullptr; |
299 | 298 | const size_t columns = static_cast<size_t>(outputShape[1]); |
300 | 299 | // Validate before opening the destination, so invalid predictions do not |
301 | 300 | // replace an existing file with a partial matrix. |
302 | | - auto valueAt = [&](size_t i) { return fp32 ? fp32[i] : fp16Data[i].ToFloat(); }; |
| 301 | + auto valueAt = [&](size_t i) { return fp32 ? fp32[i] : (float)fp16Data[i]; }; |
303 | 302 | for (size_t i = 0; i < info.GetElementCount(); ++i) { |
304 | 303 | if (!std::isfinite(valueAt(i))) { |
305 | 304 | throw std::runtime_error("Prediction export found a nonfinite value"); |
|
0 commit comments