Allocate d_y_out only for G1 kernel instead of always allocating before launch, and track kernel type with is_g2 flag for clearer control flow.
Allocate d_y_out only for G1 kernel instead of always allocating before launch, and track kernel type with is_g2 flag for clearer control flow.