Skip to content

Commit 35c56cc

Browse files
committed
Update
[ghstack-poisoned]
2 parents 014130c + 4457748 commit 35c56cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1340
-1267
lines changed

.ci/scripts/utils.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ build_executorch_runner_cmake() {
131131
else
132132
CXXFLAGS=""
133133
fi
134-
# This command uses buck2 to gather source files and buck2 could crash flakily
135-
# on MacOS
136134
CXXFLAGS="$CXXFLAGS" retry cmake -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" -DCMAKE_BUILD_TYPE="${1:-Release}" ..
137135
popd || return
138136

CMakeLists.txt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ if(NOT PYTHON_EXECUTABLE)
7979
endif()
8080
announce_configured_options(PYTHON_EXECUTABLE)
8181

82-
if(NOT BUCK2)
83-
resolve_buck2()
84-
endif()
85-
announce_configured_options(BUCK2)
86-
8782
announce_configured_options(CMAKE_CXX_COMPILER_ID)
8883
announce_configured_options(CMAKE_TOOLCHAIN_FILE)
8984
announce_configured_options(BUILD_TESTING)
@@ -318,17 +313,6 @@ if(EXECUTORCH_SRCS_FILE)
318313
)
319314
endif()
320315
executorch_load_build_variables()
321-
if(NOT EXECUTORCH_SRCS_FILE)
322-
# A file wasn't provided. Run a script to extract the source lists from the
323-
# buck2 build system and write them to a file we can include.
324-
#
325-
# NOTE: This will only happen once during cmake setup, so it will not re-run
326-
# if the buck2 targets change.
327-
message(STATUS "executorch: Generating source lists")
328-
set(EXECUTORCH_SRCS_FILE "${CMAKE_CURRENT_BINARY_DIR}/executorch_srcs.cmake")
329-
extract_sources(${EXECUTORCH_SRCS_FILE})
330-
executorch_validate_build_variables()
331-
endif()
332316

333317
# Detect if an iOS toolchain is set.
334318
if(CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")

backends/arm/quantizer/arm_quantizer.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,20 @@ def get_symmetric_quantization_config(
101101
weight_observer_or_fake_quant_ctr: ObserverOrFakeQuantizeConstructor = (
102102
MinMaxObserver
103103
)
104+
104105
# Determine the right observer/fake-quant constructor
105106
if is_qat:
106-
# Set plain fake-quant with true min/max
107-
weight_observer_or_fake_quant_ctr = FakeQuantize
107+
if is_per_channel:
108+
weight_observer_or_fake_quant_ctr = PerChannelMinMaxObserver
109+
else:
110+
# Set plain fake-quant with true min/max
111+
weight_observer_or_fake_quant_ctr = FakeQuantize
108112
else:
109113
# PTQ: set min/max observer
110114
weight_observer_or_fake_quant_ctr = (
111115
PerChannelMinMaxObserver if is_per_channel else MinMaxObserver
112116
)
113117

114-
extra_args = {"eps": 2**-12}
115-
116118
weight_quantization_spec = QuantizationSpec(
117119
dtype=torch.int8,
118120
quant_min=weight_qmin,

backends/arm/test/misc/test_bn_relu_folding_qat.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ def forward(self, x: torch.Tensor):
4040

4141

4242
models = {
43-
"conv_bn_relu": ConvModule(batch_norm=True),
44-
"conv_relu": ConvModule(batch_norm=False),
43+
# name : (model, is_per_channel)
44+
"conv_bn_relu_per_channel": (ConvModule(batch_norm=True), True),
45+
"conv_relu_per_channel": (ConvModule(batch_norm=False), True),
46+
"conv_bn_relu_per_tensor": (ConvModule(batch_norm=True), False),
47+
"conv_relu_per_tensor": (ConvModule(batch_norm=False), False),
4548
}
4649

4750

48-
@common.parametrize("model", models)
49-
def test_qat_tosa_INT(model: torch.nn.Module):
51+
@common.parametrize("test_data", models)
52+
def test_qat_tosa_INT(test_data):
53+
model, per_channel = test_data
5054
pipeline = TosaPipelineINT[input_t1](model, model.test_data, [], [], qtol=1)
5155
tosa_version = conftest.get_option("tosa_version")
5256
tosa_profiles = {
@@ -59,7 +63,7 @@ def test_qat_tosa_INT(model: torch.nn.Module):
5963
Quantize(
6064
quantizer=quantizer,
6165
quantization_config=get_symmetric_quantization_config(
62-
is_qat=True, is_per_channel=False
66+
is_qat=True, is_per_channel=per_channel
6367
),
6468
is_qat=True,
6569
),

backends/cadence/build_cadence_fusionG3.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if $STEPWISE_BUILD; then
3636
-Bcmake-out .
3737

3838
echo "Building any Cadence-specific binaries on top"
39-
CXXFLAGS="-fno-exceptions -fno-rtti" cmake -DBUCK2="$BUCK" \
39+
CXXFLAGS="-fno-exceptions -fno-rtti" cmake \
4040
-DCMAKE_TOOLCHAIN_FILE=/home/zonglinpeng/ws/zonglinpeng/executorch/backends/cadence/cadence.cmake \
4141
-DCMAKE_INSTALL_PREFIX=cmake-out \
4242
-DCMAKE_BUILD_TYPE=Release \
@@ -57,7 +57,7 @@ if $STEPWISE_BUILD; then
5757
else
5858
echo "Building Cadence toolchain with ExecuTorch packages"
5959
cmake_prefix_path="${PWD}/cmake-out/lib/cmake/ExecuTorch;${PWD}/cmake-out/third-party/gflags"
60-
CXXFLAGS="-fno-exceptions -fno-rtti" cmake -DBUCK2="$BUCK" \
60+
CXXFLAGS="-fno-exceptions -fno-rtti" cmake \
6161
-DCMAKE_PREFIX_PATH="${cmake_prefix_path}" \
6262
-DHAVE_SYS_STAT_H=ON \
6363
-DCMAKE_TOOLCHAIN_FILE=./backends/cadence/cadence.cmake \

backends/cadence/build_cadence_hifi4.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if $STEPWISE_BUILD; then
3535
-Bcmake-out .
3636

3737
echo "Building any Cadence-specific binaries on top"
38-
CXXFLAGS="-fno-exceptions -fno-rtti" cmake -DBUCK2="$BUCK" \
38+
CXXFLAGS="-fno-exceptions -fno-rtti" cmake \
3939
-DCMAKE_TOOLCHAIN_FILE=./backends/cadence/cadence.cmake \
4040
-DCMAKE_INSTALL_PREFIX=cmake-out \
4141
-DCMAKE_BUILD_TYPE=Release \
@@ -56,7 +56,7 @@ if $STEPWISE_BUILD; then
5656
else
5757
echo "Building Cadence toolchain with ExecuTorch packages"
5858
cmake_prefix_path="${PWD}/cmake-out/lib/cmake/ExecuTorch;${PWD}/cmake-out/third-party/gflags"
59-
CXXFLAGS="-fno-exceptions -fno-rtti" cmake -DBUCK2="$BUCK" \
59+
CXXFLAGS="-fno-exceptions -fno-rtti" cmake \
6060
-DCMAKE_PREFIX_PATH="${cmake_prefix_path}" \
6161
-DCMAKE_TOOLCHAIN_FILE=./backends/cadence/cadence.cmake \
6262
-DCMAKE_INSTALL_PREFIX=cmake-out \

backends/vulkan/runtime/graph/ComputeGraph.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -861,25 +861,6 @@ void ComputeGraph::prepare() {
861861
}
862862

863863
execute_threshold_node_count_ = count_threshold;
864-
865-
for (SharedObject& shared_object : shared_objects_) {
866-
shared_object.allocate(this);
867-
shared_object.bind_users(this);
868-
}
869-
}
870-
871-
void ComputeGraph::prepare_pipelines() {
872-
for (std::unique_ptr<PrepackNode>& node : prepack_nodes_) {
873-
node->prepare_pipelines(this);
874-
}
875-
for (std::unique_ptr<ExecuteNode>& node : execute_nodes_) {
876-
node->prepare_pipelines(this);
877-
}
878-
context_->pipeline_cache().create_pipelines(pipeline_descriptors_);
879-
880-
pipeline_descriptors_ = std::unordered_set<
881-
vkapi::ComputePipelineCache::Key,
882-
vkapi::ComputePipelineCache::Hasher>();
883864
}
884865

885866
void ComputeGraph::prepare_pipelines() {

backends/xnnpack/partition/config/xnnpack_config.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
from typing import List, Optional
1111

1212
import torch
13+
from executorch.backends.xnnpack.utils.quant_utils import (
14+
is_dequant,
15+
is_qparam,
16+
is_quant,
17+
)
1318
from executorch.exir.backend.canonical_partitioners.config_partitioner import (
1419
format_target_name,
1520
PartitionerConfig,
@@ -223,9 +228,18 @@ def _check_node_has_valid_dtype(self, node):
223228
valid_dtypes = {
224229
torch.float32,
225230
torch.float16,
226-
torch.int8,
227-
torch.qint8,
228231
}
232+
# Only allow int8 and quant dtypes for quant operations
233+
if is_quant(node) or is_dequant(node) or is_qparam(node):
234+
valid_dtypes.update(
235+
{
236+
torch.qint32,
237+
torch.qint8,
238+
torch.quint8,
239+
torch.int8,
240+
}
241+
)
242+
229243
if (
230244
node.op != "placeholder"
231245
and node.op != "call_function"

examples/apple/mps/scripts/build_mps_executor_runner.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ done
3838

3939
rm -rf "$OUTPUT"
4040

41-
cmake -DBUCK2="$BUCK" \
41+
cmake \
4242
-DCMAKE_INSTALL_PREFIX=cmake-out \
4343
-DCMAKE_BUILD_TYPE="$MODE" \
4444
-DEXECUTORCH_BUILD_DEVTOOLS=ON \

examples/apple/mps/test_mps.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cmake_install_executorch_devtools_lib() {
1515
echo "Installing libexecutorch.a, libportable_kernels.a, libetdump.a, libbundled_program.a"
1616
rm -rf cmake-out
1717

18-
retry cmake -DBUCK2="$BUCK" \
18+
retry cmake \
1919
-DCMAKE_INSTALL_PREFIX=cmake-out \
2020
-DCMAKE_BUILD_TYPE=Release \
2121
-DEXECUTORCH_BUILD_DEVTOOLS=ON \
@@ -56,11 +56,5 @@ then
5656
PYTHON_EXECUTABLE=python3
5757
fi
5858

59-
if [[ -z $BUCK ]];
60-
then
61-
BUCK=buck2
62-
fi
63-
64-
6559
cmake_install_executorch_devtools_lib
6660
test_cmake_mps

0 commit comments

Comments
 (0)