Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions backends/native/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,20 @@ target_compile_options(
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-fexceptions>
)

# Op packages with bundled samples, one per op and quantization scheme.
# Op packages with bundled samples, one per op and quantization scheme. The
# environment pins the eager kernels' ISA and threads, so the golden is the same
# on any x86 host with AVX2. Other hosts can differ.
set(_native_op_samples ${CMAKE_CURRENT_BINARY_DIR}/op_samples)
file(GLOB _native_op_samples_srcs CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/samples/*.py
)
add_custom_command(
OUTPUT ${_native_op_samples}.stamp
COMMAND
${CMAKE_COMMAND} -E env "PYTHONPATH=${EXECUTORCH_ROOT}/src"
${PYTHON_EXECUTABLE} -m executorch.backends.native.test.samples.generate
--out ${_native_op_samples}
${CMAKE_COMMAND} -E env MKL_CBWR=COMPATIBLE ONEDNN_MAX_CPU_ISA=AVX2
ATEN_CPU_CAPABILITY=avx2 OMP_NUM_THREADS=1 MKL_NUM_THREADS=1
"PYTHONPATH=${EXECUTORCH_ROOT}/src" ${PYTHON_EXECUTABLE} -m
executorch.backends.native.test.samples.generate --out ${_native_op_samples}
COMMAND ${CMAKE_COMMAND} -E touch ${_native_op_samples}.stamp
DEPENDS ${_native_op_samples_srcs}
${EXECUTORCH_ROOT}/backends/test/suite/operators/test_linear.py
Expand Down
6 changes: 4 additions & 2 deletions backends/native/test/samples/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ fbcode_target(
],
)

# Op packages with bundled samples, one per op and quantization scheme.
# Op packages with bundled samples, one per op and quantization scheme. The
# environment pins the eager kernels' ISA and threads, so the golden is the same
# on any x86 host with AVX2. Other hosts can differ.
fbcode_target(
_kind = runtime.genrule,
name = "op_samples",
out = "op_samples",
cmd = "$(exe :generate) --out $OUT",
cmd = "MKL_CBWR=COMPATIBLE ONEDNN_MAX_CPU_ISA=AVX2 ATEN_CPU_CAPABILITY=avx2 OMP_NUM_THREADS=1 MKL_NUM_THREADS=1 $(exe :generate) --out $OUT",
visibility = ["//executorch/backends/native/test/..."],
)
7 changes: 6 additions & 1 deletion backends/native/test/samples/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
# LICENSE file in the root directory of this source tree.

"""Write <op>_<scheme>.ptn for each op and quantization scheme that fits a case
of the op."""
of the op.

Golden outputs depend on the eager kernels' ISA and threads; the op_samples
genrule and the native_op_samples CMake target pin them, so build one of those
rather than running this module to reproduce their packages.
"""

import argparse
import logging
Expand Down
Loading