lightning-thunder icon indicating copy to clipboard operation
lightning-thunder copied to clipboard

default transforms for thunder.jit

Open kshitij12345 opened this issue 1 year ago • 5 comments

Similar to default executors, we should have a good default for transforms to thunder.jit. This issue is to discuss how an API for the same would look like.

One option is that it could look similar to get_default_executors() -> List[Executor]. It makes more sense for executors as the higher priority executor will pick-up an operator (and lower priority would be ignored). In case of transforms, the transforms will applied in order and order of transform application maybe important. However, note that this is how thunder.jit takes in transforms currently (see docs), and applies them in the order they appear.

Context - We may want to make the ConstantFolding transform a default and this issue is to facilitate the discussion around the same. See https://github.com/Lightning-AI/lightning-thunder/issues/1250 and https://github.com/Lightning-AI/lightning-thunder/pull/1273

cc @lantiga @mruberry @apaz-cli

kshitij12345 avatar Oct 14 '24 19:10 kshitij12345

@kshitij12345 is the constant folding as currently committed applied by default on at least the ThunderFX path, today? Or would we need this or manual intervention to apply that pass at all?

tfogal avatar Oct 18 '24 16:10 tfogal

is the constant folding as currently committed applied by default on at least the ThunderFX path, today?

It is off by default even on ThunderFX path. For now, we can manually specify the pass with

from thunder.transforms.constant_folding import ConstantFolding
backend = ThunderCompiler(transforms=[ConstantFolding(),])

kshitij12345 avatar Oct 18 '24 17:10 kshitij12345

So I think it would be really good if we could use recipes #1188 here to enable transforms by default. Last I knew, we had an eta of 1-2 weeks. (cc @lantiga )

t-vi avatar Oct 18 '24 17:10 t-vi

ack, appreciate the fast response! but also, take a break, it's late on a Friday ;-)

tfogal avatar Oct 18 '24 17:10 tfogal

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 16 '25 06:04 stale[bot]