Skip to content

Commit

Permalink
Extend int dtype with uint8 to skip lowering uint8-input ops in AIT s…
Browse files Browse the repository at this point in the history
…plitter (#989)

Summary:
Pull Request resolved: #989

As title

Reviewed By: frank-wei, qxy11, 22quinn

Differential Revision: D53249618

fbshipit-source-id: 21643eab421eaec4376187ac6a48a3f263474d26
  • Loading branch information
zoranzhao authored and facebook-github-bot committed Jan 31, 2024
1 parent 89fd517 commit ac56a6c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions fx2ait/fx2ait/ait_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def create_ait_operator_support(
else [
ops.OpSupports.decline_if_input_dtype(torch.int64),
ops.OpSupports.decline_if_input_dtype(torch.int32),
ops.OpSupports.decline_if_input_dtype(torch.uint8),
]
)
chained_not_supported_ops += [
Expand Down
17 changes: 17 additions & 0 deletions fx2ait/fx2ait/test/test_ait_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,23 @@ def forward(self, a):
{"_run_on_gpu_0"},
)

# nodes w/ uint8 input should not be lowered
mod = acc_tracer.trace(test_mod, [x])
splitter = AITSplitter(
mod,
(x.to(torch.uint8).cuda(),),
operator_support,
settings,
)

split_results_int = splitter.generate_split_results()

self.assertTrue(len(split_results_int), 1)
self.assertEqual(
dict(split_results_int.split_module.named_children()).keys(),
{"_run_on_gpu_0"},
)

# nodes w/ integer input should be lowered
mod = acc_tracer.trace(test_mod, [x])
settings.allow_int_inputs = True
Expand Down

0 comments on commit ac56a6c

Please sign in to comment.