Skip to content

Commit 16d6034

Browse files
authored
FPGA: Fix ambiguity of math function calls (#2342)
Upstream LLVM removed the auto-included math.h, making some samples fail to compile without explicitly including math.h or using the sycl:: equivalent.
1 parent 9efc800 commit 16d6034

File tree

5 files changed

+6
-3
lines changed

5 files changed

+6
-3
lines changed

DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/anr/src/anr.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <type_traits>
1515
#include <utility>
1616
#include <vector>
17+
#include <math.h>
1718

1819
#include "anr_params.hpp"
1920
#include "column_stencil.hpp"

DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/matmul/src/matmul_demo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ bool EqualMat(std::vector<float> &c_matrix, std::vector<float> &c_reference,
4141
<< c_reference[idx] << std::endl;
4242
#endif
4343
}
44-
if (!std::isfinite(c_matrix[idx])) {
44+
if (!sycl::isfinite(c_matrix[idx])) {
4545
passed = false;
4646
#if DEBUG
4747
std::cout << "C[" << col << "][" << row << "] = " << c_matrix[idx]
@@ -246,4 +246,4 @@ int main(int argc, char *argv[]) {
246246

247247
std::terminate();
248248
}
249-
} // end of main
249+
} // end of main

DirectProgramming/C++SYCL_FPGA/Tutorials/Features/ac_fixed/src/ac_fixed.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <sycl/ext/intel/fpga_extensions.hpp>
55

66
#include <iomanip> // for std::setprecision
7+
#include <math.h>
78

89
#include "exception_handler.hpp"
910

DirectProgramming/C++SYCL_FPGA/Tutorials/Features/optimization_targets/src/optimization_targets.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ int main() {
125125
// validate results
126126
for (size_t i = 0; i < kInputSize; i++) {
127127
GreyType golden = Compute(r[i], g[i], b[i]);
128-
if (std::fabs(out[i] - golden) > 1e-4) {
128+
if (sycl::fabs(out[i] - golden) > 1e-4) {
129129
std::cout << "Result mismatch:\n"
130130
<< "out[" << i << "] = " << out[i] << "; golden = " << golden
131131
<< '\n';

DirectProgramming/C++SYCL_FPGA/Tutorials/Features/speculated_iterations/src/speculated_iterations.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <iostream>
1111
#include <string>
1212
#include <type_traits>
13+
#include <math.h>
1314

1415
#include "exception_handler.hpp"
1516

0 commit comments

Comments
 (0)