Repository navigation
Remove apply_cp_to_forward, the partial_dtensor Context Parallel path - #4218
Conversation
[ghstack-poisoned]
| if ac_config is not None: | ||
| apply_ac(model) | ||
|
|
||
| if parallelism.spmd_backend == "spmd_types": |
There was a problem hiding this comment.
Use the same validate_cp_backend to validate.
| ac_config: ActivationCheckpointingConfig, | ||
| dump_folder: str, | ||
| ): | ||
| validate_cp_backend(parallel_dims) |
There was a problem hiding this comment.
For FLUX, right now the only supported attention backend is SDPA with full causal / full bidirectional masking.
If we deprecate the CP support for SDPA, we should at least support Varlen / Flex (and deprecate SDPA?). Another option is to have a Ring-SDPA with your pytorch side API called within.
There was a problem hiding this comment.
With spmd_types, Flux is doing allgather + SDPA. We can deprecate SDPA usage. I don't think it worths to maintain SDPA only for Flux. Flex + FA3/FA4 can achieve a better performance. We can do this in a separate PR if we decide to switch the attention to Flex.
[ghstack-poisoned]
It's too much for us to maintain difference CP path. This PR remove apply_cp_to_forward CP mechanism. Only config-based CP is preserved. This disables: 1. graph_trainer + CP (once spmd_types is enabled for graph_trainer, we can re-enable it) 2. partial_dtensor + CP ghstack-source-id: 108cc24 Pull-Request: #4218
[ghstack-poisoned]
It's too much for us to maintain difference CP path. This PR remove apply_cp_to_forward CP mechanism. Only config-based CP is preserved. This disables: 1. graph_trainer + CP (once spmd_types is enabled for graph_trainer, we can re-enable it) 2. partial_dtensor + CP ghstack-source-id: e776be1 Pull-Request: #4218
tianyu-l
left a comment
There was a problem hiding this comment.
With spmd_types, Flux is doing allgather + SDPA.
Oh I wasn't aware of this. Good to know.
Flex + FA3/FA4 can achieve a better performance. We can do this in a separate PR if we decide to switch the attention to Flex.
There's one caveat though. @acisseJZhong is removing batch dim for decoder models, but for FLUX, it's still having batch dim + seq dim -- each row in the batch uses full causal / bidirectional mask.
- If we also fold for flux, would Flex/Varlen be faster? Probably, but I don't know.
- If we don't fold for flux, we have to have if-else in Flex/Varlen on num_dims, which is not ideal.
Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.15.0) (oldest at bottom): * #4218 * __->__ #4217 Now that spmd_types is the default backend (thanks to @pianpwk) and partial_dtensor is the fallback, drop `parallelism.spmd_backend == "full_dtensor"` and everything that only existed to support it. This makes people's life easier.
I think FA3/FA4 should be faster, SDPA is using FA2. But I don't know if we can fold for Flux?
Okay, this is a good point. Then we either fold for Flux if possible, or just make Flux maintain its own FlexAttention kernel. |
we can always fold, just need to define proper masks -- the comparison of perf is between
|
[ghstack-poisoned]
It's too much for us to maintain difference CP path. This PR remove apply_cp_to_forward CP mechanism. Only config-based CP is preserved. This disables: 1. graph_trainer + CP (once spmd_types is enabled for graph_trainer, we can re-enable it) 2. partial_dtensor + CP ghstack-source-id: bcdbd97 Pull-Request: #4218
[ghstack-poisoned]
It's too much for us to maintain difference CP path. This PR remove apply_cp_to_forward CP mechanism. Only config-based CP is preserved. This disables: 1. graph_trainer + CP (once spmd_types is enabled for graph_trainer, we can re-enable it) 2. partial_dtensor + CP ghstack-source-id: be6a623 Pull-Request: #4218
|
@fegin Hello, with |
Stack from ghstack (oldest at bottom):
It's too much for us to maintain difference CP paths. This PR removes apply_cp_to_forward CP mechanism. Only config-based CP is preserved.
This disables: