Skip to content

Commit

Permalink
2024-11-20 nightly release (f40daea)
Browse files Browse the repository at this point in the history
  • Loading branch information
pytorchbot committed Nov 20, 2024
1 parent 1768668 commit 02d28b4
Show file tree
Hide file tree
Showing 21 changed files with 1,340 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/scripts/check_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ def main() -> None:

try:
if not has_required_labels(pr):
print(LABEL_ERR_MSG)
print(LABEL_ERR_MSG, flush=True)
add_label_err_comment(pr)
if args.exit_non_zero:
sys.exit(1)
raise RuntimeError("PR does not have required labels")
else:
delete_all_label_err_comments(pr)
except Exception as e:
if args.exit_non_zero:
sys.exit(1)
raise RuntimeError(f"Error checking labels: {e}") from e

sys.exit(0)

Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/github_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ def gh_fetch_url(
headers: Optional[Dict[str, str]] = None,
data: Union[Optional[Dict[str, Any]], str] = None,
method: Optional[str] = None,
reader: Callable[[Any], Any] = lambda x: x.read(),
reader: Callable[[Any], Any] = json.load,
) -> Any:
return gh_fetch_url_and_headers(
url, headers=headers, data=data, reader=json.load, method=method
url, headers=headers, data=data, reader=reader, method=method
)[1]


Expand Down Expand Up @@ -169,7 +169,7 @@ def gh_post_commit_comment(

def gh_delete_comment(org: str, repo: str, comment_id: int) -> None:
url = f"{GITHUB_API_URL}/repos/{org}/{repo}/issues/comments/{comment_id}"
gh_fetch_url(url, method="DELETE")
gh_fetch_url(url, method="DELETE", reader=lambda x: x.read())


def gh_fetch_merge_base(org: str, repo: str, base: str, head: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/android-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
fail-fast: false
with:
runner: linux.4xlarge
docker-image: executorch-ubuntu-22.04-clang12-android
docker-image: executorch-ubuntu-22.04-qnn-sdk
submodules: 'true'
timeout: 60
upload-artifact: android-models
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ jobs:
fail-fast: false
with:
runner: linux.2xlarge
docker-image: executorch-ubuntu-22.04-clang12-android
docker-image: executorch-ubuntu-22.04-qnn-sdk
submodules: 'true'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 900
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "backends/arm/third-party/ethos-u-core-driver"]
path = backends/arm/third-party/ethos-u-core-driver
url = https://review.mlplatform.org/ml/ethos-u/ethos-u-core-driver
url = https://git.mlplatform.org/ml/ethos-u/ethos-u-core-driver.git/
[submodule "backends/arm/third-party/serialization_lib"]
path = backends/arm/third-party/serialization_lib
url = https://review.mlplatform.org/tosa/serialization_lib
url = https://git.mlplatform.org/tosa/serialization_lib.git/
[submodule "backends/vulkan/third-party/Vulkan-Headers"]
path = backends/vulkan/third-party/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers
Expand Down
1 change: 1 addition & 0 deletions backends/arm/operators/op_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def define_node(

if needs_rescale:
# Scale output back to 8 bit
# pyre-ignore
tqutils.rescale_node_back_to_int8(node, add_output, scale, tosa_graph)


Expand Down
48 changes: 48 additions & 0 deletions backends/cadence/aot/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,51 @@ python_library(
"//executorch/exir/dialects:lib",
],
)

python_library(
name = "graph_builder",
srcs = [
"graph_builder.py",
],
typing = True,
deps = [
"fbcode//caffe2:torch",
"fbcode//executorch/exir:pass_base",
],
)

python_library(
name = "fuse_ops",
srcs = [
"fuse_ops.py",
],
typing = True,
deps = [
"//caffe2:torch",
":compiler_utils",
"//executorch/backends/cadence/aot:pass_utils",
"//executorch/backends/cadence/aot:utils",
"//executorch/exir:pass_base",
"//executorch/exir/dialects:lib",
"//executorch/exir/dialects/edge:lib",
"//executorch/exir/passes:lib",
"//executorch/exir/passes:spec_prop_pass",
],
)

python_unittest(
name = "test_graph_builder",
srcs = [
"tests/test_graph_builder.py",
],
typing = True,
deps = [
"//caffe2:torch",
"//executorch/backends/cadence/aot:graph_builder",
"//executorch/backends/cadence/aot:pass_utils",
"//executorch/exir:pass_base",
"//executorch/exir/dialects:lib",
"//later:lib",
":ops_registrations"
],
)
21 changes: 20 additions & 1 deletion backends/cadence/aot/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,26 @@ def export_to_edge(
# Export the model and lower it to an EdgeProgramManager (in edge IR), and
# apply passes specific to Cadence DSP execution. Return both to print the
# differences.
def export_to_cadence_edge_executorch(
def export_to_cadence(
model: torch.nn.Module,
inputs: tuple[object, ...],
dump_graphs: bool = False,
output_dir: Optional[str] = None,
opt_level: int = 1,
) -> EdgeProgramManager:
edge_prog_manager = export_to_edge(model, inputs)
cadence_passes = get_cadence_passes(opt_level)

# Run a couple required passes for quant/dequant ops
cadence_prog_manager = edge_prog_manager.transform(
cast(
list[Callable[[torch.fx.GraphModule], Optional[PassResult]]], cadence_passes
)
)
return cadence_prog_manager


def export_to_executorch_gen_etrecord(
model: torch.nn.Module,
inputs: tuple[object, ...],
dump_graphs: bool = False,
Expand Down
6 changes: 3 additions & 3 deletions backends/cadence/aot/export_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from executorch.backends.cadence.aot.compiler import (
convert_pt2,
export_to_cadence_edge_executorch,
export_to_executorch_gen_etrecord,
fuse_pt2,
)

Expand Down Expand Up @@ -86,8 +86,8 @@ def export_model(
quantized_model = fuse_pt2(converted_model, quantizer)

# Get edge program after Cadence specific passes
exec_prog: ExecutorchProgramManager = export_to_cadence_edge_executorch(
quantized_model, example_inputs, working_dir
exec_prog: ExecutorchProgramManager = export_to_executorch_gen_etrecord(
quantized_model, example_inputs, output_dir=working_dir
)

logging.info("Final exported graph:\n")
Expand Down
Loading

0 comments on commit 02d28b4

Please sign in to comment.