Skip to content

Commit 25bf93e

Browse files
authored
Fix kv cache pyre and build
Differential Revision: D68132579 Pull Request resolved: #7638
1 parent a10eabd commit 25bf93e

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
@@ -417,12 +417,11 @@ def to_backend(self, partitioners: Optional[List[Partitioner]]) -> "LLMEdgeManag
417417
return self
418418

419419
def to_executorch(
420-
self, passes: Optional[List[PassType]] = None
420+
self, passes: Optional[List[ExportPass]] = None
421421
) -> "LLMEdgeManager":
422422
"""
423423
Lower the model to executorch and get an ExecutorchProgram.
424424
"""
425-
assert self.edge_manager, "Need to run export_to_edge() first"
426425
to_executorch_passes = [
427426
# If there are Linear operations left in the graph, let's execute
428427
# them with the optimized op_linear rather than materializing a
@@ -431,11 +430,19 @@ def to_executorch(
431430
QuantFusionPass(),
432431
]
433432
if passes:
433+
# pyre-fixme[6]: In call `list.extend`, for 1st positional argument,
434+
# expected `Iterable[Union[ConvertToLinearPass, QuantFusionPass]]` but
435+
# got `List[ExportPass]
434436
to_executorch_passes.extend(passes)
435437

438+
assert self.edge_manager, "Need to run export_to_edge() first"
436439
self.export_program = self.edge_manager.to_executorch(
437440
ExecutorchBackendConfig(
438441
extract_delegate_segments=True,
442+
# pyre-fixme[6]: In call `ExecutorchBackendConfig.__init__`, for
443+
# argument `passes`, expected `List[typing.Callable[[GraphModule],
444+
# Optional[PassResult]]]` but got `List[Union[ConvertToLinearPass,
445+
# QuantFusionPass]]`.
439446
passes=to_executorch_passes,
440447
memory_planning_pass=MemoryPlanningPass(alloc_graph_input=False),
441448
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)