Skip to content

Commit fdd8e12

Browse files
committed
Update
[ghstack-poisoned]
2 parents 2706db0 + be65301 commit fdd8e12

File tree

5 files changed

+6
-84
lines changed

5 files changed

+6
-84
lines changed

.ci/scripts/test_llama.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ cmake_install_executorch_libraries() {
154154
echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a"
155155
rm -rf cmake-out
156156
retry cmake --preset llm \
157+
-DEXECUTORCH_BUILD_TESTS=ON \
157158
-DBUILD_TESTING=OFF \
158159
-DCMAKE_INSTALL_PREFIX=cmake-out \
159160
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
@@ -170,6 +171,7 @@ cmake_build_llama_runner() {
170171
popd
171172
dir="examples/models/llama"
172173
retry cmake \
174+
-DEXECUTORCH_BUILD_TESTS=ON \
173175
-DBUILD_TESTING=OFF \
174176
-DCMAKE_INSTALL_PREFIX=cmake-out \
175177
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \

.ci/scripts/unittest-windows.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if ($LASTEXITCODE -ne 0) {
2929

3030
# Run pytest with coverage
3131
# pytest -n auto --cov=./ --cov-report=xml
32-
pytest --continue-on-collection-errors -v --full-trace -c pytest-windows.ini -n auto
32+
pytest -v --full-trace -c pytest-windows.ini -n auto
3333
if ($LASTEXITCODE -ne 0) {
3434
Write-Host "Pytest invocation was unsuccessful. Exit code: $LASTEXITCODE."
3535
exit $LASTEXITCODE

backends/cadence/hifi/kernels/kernels.cpp

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -127,60 +127,6 @@ void dequantize(
127127
}
128128
}
129129

130-
// Requantize the int8_t/uint8_t in value to a uint8_t/int8_t out value.
131-
// The scale and zero_point for requantization are in the args.
132-
template <typename IT, typename OT>
133-
__attribute__((always_inline)) OT requantize(
134-
const IT in,
135-
float in_scale,
136-
int32_t in_zero_point,
137-
float inv_out_scale,
138-
int32_t out_zero_point) {
139-
float dequant = dequantize<IT>(in, in_scale, in_zero_point);
140-
return quantize<OT>(dequant, inv_out_scale, out_zero_point);
141-
}
142-
143-
// Requantize the int8_t/uint8_t in array to a uint8_t/int8_t out array.
144-
// The scale and zero_point for requantization are in the args.
145-
template <typename IT, typename OT>
146-
void requantize(
147-
OT* __restrict__ out,
148-
const IT* __restrict__ in,
149-
float in_scale,
150-
int32_t in_zero_point,
151-
float inv_out_scale,
152-
int32_t out_zero_point,
153-
size_t size) {
154-
xtfloatx2 in_scale_vec = (xtfloatx2)in_scale;
155-
xtfloatx2 in_zero_vec = XT_FLOAT_SX2(in_zero_point, 0);
156-
xtfloatx2 inv_out_scale_vec = (xtfloatx2)inv_out_scale;
157-
xtfloatx2 out_zero_vec = XT_FLOAT_SX2(out_zero_point, 0);
158-
159-
float min_val = std::numeric_limits<OT>::min();
160-
float max_val = std::numeric_limits<OT>::max();
161-
162-
size_t i = 0;
163-
// Vectorize by 2
164-
for (; i < (size & ~1); i += 2) {
165-
xtfloatx2 in_vec = {(float)in[i], (float)in[i + 1]};
166-
xtfloatx2 t0 = XT_SUB_SX2(in_vec, in_zero_vec);
167-
xtfloatx2 t1 = XT_MUL_SX2(t0, in_scale_vec);
168-
169-
xtfloatx2 acc = out_zero_vec;
170-
XT_MADD_SX2(acc, inv_out_scale_vec, t1);
171-
xtfloatx2 t2 = XT_FIROUND_SX2(acc);
172-
ae_int32x2 t3 =
173-
XT_UTRUNC_SX2(XT_MAX_SX2(XT_MIN_SX2(t2, max_val), min_val), 0);
174-
out[i] = AE_MOVAD32_H(t3);
175-
out[i + 1] = AE_MOVAD32_L(t3);
176-
}
177-
// Handle residual iteration
178-
if (i < size) {
179-
out[i] = requantize<IT, OT>(
180-
in[i], in_scale, in_zero_point, inv_out_scale, out_zero_point);
181-
}
182-
}
183-
184130
// explicit template instantiation
185131

186132
#define typed_quantize_val(dtype) \
@@ -229,34 +175,6 @@ typed_dequantize_vec(uint16_t);
229175
typed_dequantize_vec(int32_t);
230176
#undef typed_dequantize_vec
231177

232-
#define typed_requantize_val(itype, otype) \
233-
template __attribute__((always_inline)) otype requantize( \
234-
const itype in, \
235-
float in_scale, \
236-
int32_t in_zero_point, \
237-
float inv_out_scale, \
238-
int32_t out_zero_point);
239-
typed_requantize_val(int8_t, int8_t);
240-
typed_requantize_val(uint8_t, uint8_t);
241-
typed_requantize_val(int8_t, uint8_t);
242-
typed_requantize_val(uint8_t, int8_t);
243-
#undef typed_requantize_val
244-
245-
#define typed_requantize_vec(itype, otype) \
246-
template void requantize( \
247-
otype* __restrict__ out, \
248-
const itype* __restrict__ in, \
249-
float in_scale, \
250-
int32_t in_zero_point, \
251-
float inv_out_scale, \
252-
int32_t out_zero_point, \
253-
size_t size);
254-
typed_requantize_vec(int8_t, int8_t);
255-
typed_requantize_vec(uint8_t, uint8_t);
256-
typed_requantize_vec(int8_t, uint8_t);
257-
typed_requantize_vec(uint8_t, int8_t);
258-
#undef typed_requantize_vec
259-
260178
}; // namespace kernels
261179
}; // namespace HiFi
262180
}; // namespace impl

examples/models/llama/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ target_include_directories(llama_main PUBLIC ${_common_include_directories})
220220
target_link_libraries(llama_main PUBLIC llama_runner ${link_libraries})
221221
target_compile_options(llama_main PUBLIC ${_common_compile_options})
222222
if(APPLE)
223-
target_link_options(llama_main PRIVATE -Wl,-rpath,@executable_path)
223+
target_link_options(llama_main PRIVATE -Wl,-rpath,@loader_path)
224224
elseif(UNIX)
225225
set_target_properties(llama_main PROPERTIES LINK_FLAGS "-Wl,-rpath='$ORIGIN'")
226226
endif()
227+
# Windows doesn't need rpath - DLLs are found via standard Windows search order

runtime/executor/test/method_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <cstdlib>
1010
#include <filesystem>
11+
#include <unordered_map>
1112

1213
#include <executorch/extension/data_loader/file_data_loader.h>
1314
#include <executorch/extension/flat_tensor/flat_tensor_data_map.h>

0 commit comments

Comments
 (0)