Skip to content

Commit 8d2c21d

Browse files
jackzhxngYIWENX14
authored andcommitted
Fix kv cache pyre and build
Differential Revision: D68132579 Pull Request resolved: #7638
1 parent a245de0 commit 8d2c21d

File tree

6 files changed

+25
-3
lines changed

6 files changed

+25
-3
lines changed

examples/models/llama/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ runtime.python_library(
109109
"//executorch/backends/vulkan/_passes:vulkan_passes",
110110
"//executorch/examples/models:model_base",
111111
"//executorch/examples/models:models",
112+
"//executorch/exir/passes:init_mutable_pass",
112113
"//executorch/extension/llm/custom_ops:custom_ops_aot_py",
113114
"//executorch/extension/llm/export:export_lib",
114115
# one definition has to be included in the user of the libarary

exir/emit/test/TARGETS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ python_unittest(
2020
"//executorch/exir/emit:lib",
2121
"//executorch/exir/passes:const_prop_pass",
2222
"//executorch/exir/passes:constant_prop_pass",
23+
"//executorch/exir/passes:init_mutable_pass",
2324
"//executorch/exir/tests:lib",
2425
"//executorch/exir/tests:models",
2526
"//executorch/extension/pybindings:portable_lib",
27+
"//executorch/runtime:runtime",
2628
],
2729
)

exir/passes/TARGETS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,16 @@ python_library(
220220
],
221221
)
222222

223+
python_library(
224+
name = "init_mutable_pass",
225+
srcs = [
226+
"init_mutable_pass.py",
227+
],
228+
deps = [
229+
"//executorch/exir:delegate",
230+
],
231+
)
232+
223233
python_library(
224234
name = "sym_shape_eval_pass",
225235
srcs = [

extension/llm/export/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ runtime.python_library(
3333
"//executorch/backends/vulkan/partitioner:vulkan_partitioner",
3434
"//executorch/backends/vulkan/quantizer:vulkan_quantizer",
3535
"//executorch/backends/xnnpack/partition:xnnpack_partitioner",
36+
"//executorch/exir:delegate",
3637
"//executorch/exir:lib",
3738
"//executorch/exir/backend:backend_details",
3839
"//executorch/extension/export_util:export_util",

extension/llm/export/builder.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from executorch.exir.backend.utils import format_delegated_graph
2828
from executorch.exir.capture._config import EdgeCompileConfig, ExecutorchBackendConfig
2929

30-
from executorch.exir.pass_manager import PassType
30+
from executorch.exir.pass_base import ExportPass
3131
from executorch.exir.passes import MemoryPlanningPass
3232
from executorch.exir.passes.quant_fusion_pass import QuantFusionPass
3333
from executorch.exir.passes.sym_shape_eval_pass import ConstraintBasedSymShapeEvalPass
@@ -421,12 +421,11 @@ def to_backend(self, partitioners: Optional[List[Partitioner]]) -> "LLMEdgeManag
421421
return self
422422

423423
def to_executorch(
424-
self, passes: Optional[List[PassType]] = None
424+
self, passes: Optional[List[ExportPass]] = None
425425
) -> "LLMEdgeManager":
426426
"""
427427
Lower the model to executorch and get an ExecutorchProgram.
428428
"""
429-
assert self.edge_manager, "Need to run export_to_edge() first"
430429
to_executorch_passes = [
431430
# If there are Linear operations left in the graph, let's execute
432431
# them with the optimized op_linear rather than materializing a
@@ -435,11 +434,19 @@ def to_executorch(
435434
QuantFusionPass(),
436435
]
437436
if passes:
437+
# pyre-fixme[6]: In call `list.extend`, for 1st positional argument,
438+
# expected `Iterable[Union[ConvertToLinearPass, QuantFusionPass]]` but
439+
# got `List[ExportPass]
438440
to_executorch_passes.extend(passes)
439441

442+
assert self.edge_manager, "Need to run export_to_edge() first"
440443
self.export_program = self.edge_manager.to_executorch(
441444
ExecutorchBackendConfig(
442445
extract_delegate_segments=True,
446+
# pyre-fixme[6]: In call `ExecutorchBackendConfig.__init__`, for
447+
# argument `passes`, expected `List[typing.Callable[[GraphModule],
448+
# Optional[PassResult]]]` but got `List[Union[ConvertToLinearPass,
449+
# QuantFusionPass]]`.
443450
passes=to_executorch_passes,
444451
memory_planning_pass=MemoryPlanningPass(alloc_graph_input=False),
445452
sym_shape_eval_pass=ConstraintBasedSymShapeEvalPass(),

runtime/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ runtime.python_library(
1010
],
1111
visibility = [
1212
"//executorch/runtime/...",
13+
"//executorch/exir/emit/test/...",
1314
],
1415
)

0 commit comments

Comments
 (0)