Skip to content

Commit fd33959

Browse files
committed
Fix Makefile and symbol visibility issue.
1 parent 4189a48 commit fd33959

File tree

4 files changed

+39
-14
lines changed

4 files changed

+39
-14
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ HEADER_FILES = \
684684
ExternFuncArgument.h \
685685
ExtractTileOperations.h \
686686
FastIntegerDivide.h \
687+
FastMathFunctions.h \
687688
FindCalls.h \
688689
FindIntrinsics.h \
689690
FlattenNestedRamps.h \

src/ApproximationTables.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,30 @@ const Approximation *best_log_approximation(Halide::ApproximationPrecision preci
10191019
return find_best_approximation("log", table_log, precision, type);
10201020
}
10211021

1022+
// ====
1023+
1024+
const std::vector<Approximation> &get_table_atan() {
1025+
return table_atan;
1026+
}
1027+
const std::vector<Approximation> &get_table_sin() {
1028+
return table_sin;
1029+
}
1030+
const std::vector<Approximation> &get_table_cos() {
1031+
return table_cos;
1032+
}
1033+
const std::vector<Approximation> &get_table_tan() {
1034+
return table_tan;
1035+
}
1036+
const std::vector<Approximation> &get_table_expm1() {
1037+
return table_expm1;
1038+
}
1039+
const std::vector<Approximation> &get_table_exp() {
1040+
return table_exp;
1041+
}
1042+
const std::vector<Approximation> &get_table_log() {
1043+
return table_log;
1044+
}
1045+
10221046
} // namespace ApproximationTables
10231047
} // namespace Internal
10241048
} // namespace Halide

src/ApproximationTables.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ struct Approximation {
3232
};
3333

3434
namespace ApproximationTables {
35-
extern HALIDE_EXPORT_SYMBOL const std::vector<Approximation> table_atan;
36-
extern HALIDE_EXPORT_SYMBOL const std::vector<Approximation> table_sin;
37-
extern HALIDE_EXPORT_SYMBOL const std::vector<Approximation> table_cos;
38-
extern HALIDE_EXPORT_SYMBOL const std::vector<Approximation> table_tan;
39-
extern HALIDE_EXPORT_SYMBOL const std::vector<Approximation> table_expm1;
40-
extern HALIDE_EXPORT_SYMBOL const std::vector<Approximation> table_exp;
41-
extern HALIDE_EXPORT_SYMBOL const std::vector<Approximation> table_log;
35+
const std::vector<Approximation> &get_table_atan();
36+
const std::vector<Approximation> &get_table_sin();
37+
const std::vector<Approximation> &get_table_cos();
38+
const std::vector<Approximation> &get_table_tan();
39+
const std::vector<Approximation> &get_table_expm1();
40+
const std::vector<Approximation> &get_table_exp();
41+
const std::vector<Approximation> &get_table_log();
4242

4343
const Approximation *best_atan_approximation(Halide::ApproximationPrecision precision, Type type);
4444
const Approximation *best_sin_approximation(Halide::ApproximationPrecision precision, Type type);

test/correctness/determine_fast_function_approximation_metrics.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,55 +91,55 @@ struct FunctionToTest {
9191
[](Expr x, Expr y) { return Halide::tan(x); },
9292
[](Expr x, Expr y, Halide::ApproximationPrecision prec) { return Halide::fast_tan(x, prec); },
9393
Halide::Internal::ApproximationTables::best_tan_approximation,
94-
Halide::Internal::ApproximationTables::table_tan,
94+
Halide::Internal::ApproximationTables::get_table_tan(),
9595
{0.0f, float(PI_OVER_FOUR)},
9696
},
9797
{
9898
"atan", OO::MULPE,
9999
[](Expr x, Expr y) { return Halide::atan(x); },
100100
[](Expr x, Expr y, Halide::ApproximationPrecision prec) { return Halide::fast_atan(x, prec); },
101101
Halide::Internal::ApproximationTables::best_atan_approximation,
102-
Halide::Internal::ApproximationTables::table_atan,
102+
Halide::Internal::ApproximationTables::get_table_atan(),
103103
{0.0f, 32.0f},
104104
},
105105
{
106106
"sin", OO::MULPE,
107107
[](Expr x, Expr y) { return Halide::sin(x); },
108108
[](Expr x, Expr y, Halide::ApproximationPrecision prec) { return Halide::fast_sin(x, prec); },
109109
Halide::Internal::ApproximationTables::best_sin_approximation,
110-
Halide::Internal::ApproximationTables::table_sin,
110+
Halide::Internal::ApproximationTables::get_table_sin(),
111111
{0.0f, float(PI_OVER_TWO)},
112112
},
113113
{
114114
"cos", OO::MAE, // Only MAE uses the cos table. MULPE gets redirected to fast_sin.
115115
[](Expr x, Expr y) { return Halide::cos(x); },
116116
[](Expr x, Expr y, Halide::ApproximationPrecision prec) { return Halide::fast_cos(x, prec); },
117117
Halide::Internal::ApproximationTables::best_cos_approximation,
118-
Halide::Internal::ApproximationTables::table_cos,
118+
Halide::Internal::ApproximationTables::get_table_cos(),
119119
{0.0f, float(PI_OVER_TWO)},
120120
},
121121
{
122122
"expm1", OO::MULPE,
123123
[](Expr x, Expr y) { return makeshift_expm1(x); },
124124
[](Expr x, Expr y, Halide::ApproximationPrecision prec) { return Halide::fast_expm1(x, prec); },
125125
Halide::Internal::ApproximationTables::best_expm1_approximation,
126-
Halide::Internal::ApproximationTables::table_expm1,
126+
Halide::Internal::ApproximationTables::get_table_expm1(),
127127
{-float(0.5 * std::log(2.0)), float(0.5 * std::log(2.0))},
128128
},
129129
{
130130
"exp", OO::MULPE,
131131
[](Expr x, Expr y) { return Halide::exp(x); },
132132
[](Expr x, Expr y, Halide::ApproximationPrecision prec) { return Halide::fast_exp(x, prec); },
133133
Halide::Internal::ApproximationTables::best_exp_approximation,
134-
Halide::Internal::ApproximationTables::table_exp,
134+
Halide::Internal::ApproximationTables::get_table_exp(),
135135
{0.0f, float(std::log(2.0))},
136136
},
137137
{
138138
"log", OO::MULPE,
139139
[](Expr x, Expr y) { return Halide::log(x); },
140140
[](Expr x, Expr y, Halide::ApproximationPrecision prec) { return Halide::fast_log(x, prec); },
141141
Halide::Internal::ApproximationTables::best_log_approximation,
142-
Halide::Internal::ApproximationTables::table_log,
142+
Halide::Internal::ApproximationTables::get_table_log(),
143143
{0.75f, 1.50f},
144144
},
145145
// clang-format on

0 commit comments

Comments
 (0)