Skip to content

Commit 36e333c

Browse files
committed
Fix hlo_diff_test to compile the real NNX path
hlo_diff_test loaded each model yml directly as the top-level config, which skips base.yml and leaves pure_nnx at its pydantic schema default (False), so the test kept silently compiling the Linen path even after the NNX defaults were flipped to True in base.yml. Its reference HLOs are therefore still Linen. Compile via base.yml + model_name (the normal training path) so the config inherits base.yml's logical_axis_rules and exercises the NNX path. The three reference HLOs are regenerated for NNX via the Update HLO References workflow. Also flip the enable_nnx/pure_nnx/pure_nnx_decoder pydantic schema defaults to True so a config built without base.yml no longer silently falls back to the Linen path.
1 parent 9ce291b commit 36e333c

5 files changed

Lines changed: 5041 additions & 5037 deletions

File tree

src/maxtext/configs/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -988,11 +988,11 @@ class HardwareAndMesh(BaseModel):
988988
CustomRule.DEFAULT, description="Customized mesh and logical rules for granularity."
989989
)
990990
allow_split_physical_axes: bool = Field(False, description="Allow splitting physical axes for device mesh creation.")
991-
enable_nnx: bool = Field(False, description="Whether to use NNX for model definition.")
991+
enable_nnx: bool = Field(True, description="Whether to use NNX for model definition.")
992992
optimize_mesh_for_tpu_v6e: bool = Field(False, description="Apply transformations to the mesh for TPU v6e.")
993993
shardy: bool = Field(True, description="Whether to use shardy XLA backend.")
994-
pure_nnx_decoder: bool = Field(False, description="Whether to enable pure NNX decoder.")
995-
pure_nnx: bool = Field(False, description="Whether to enable pure NNX mode.")
994+
pure_nnx_decoder: bool = Field(True, description="Whether to enable pure NNX decoder.")
995+
pure_nnx: bool = Field(True, description="Whether to enable pure NNX mode.")
996996
remove_size_one_mesh_axis_from_type: bool = Field(
997997
True, description="Whether to remove size one mesh axis from type through jax.config."
998998
)

tests/integration/hlo_diff_test.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ def get_filtered_lines(file_path):
9393
return False
9494

9595
@pytest.mark.parametrize(
96-
"test_id, config_file, overrides",
96+
"test_id, model_name, overrides",
9797
[
9898
(
9999
"deepseek3",
100-
"src/maxtext/configs/models/deepseek3-test.yml",
100+
"deepseek3-test",
101101
{
102102
"compile_topology": "v6e-4",
103103
"base_num_decoder_layers": 4,
@@ -107,7 +107,7 @@ def get_filtered_lines(file_path):
107107
),
108108
(
109109
"llama3_8b",
110-
"src/maxtext/configs/models/llama3-8b.yml",
110+
"llama3-8b",
111111
{
112112
"compile_topology": "v6e-4",
113113
"base_num_decoder_layers": 4,
@@ -117,7 +117,7 @@ def get_filtered_lines(file_path):
117117
),
118118
(
119119
"qwen3_1.7b",
120-
"src/maxtext/configs/models/qwen3-1.7b.yml",
120+
"qwen3-1.7b",
121121
{
122122
"compile_topology": "v6e-4",
123123
"base_num_decoder_layers": 4,
@@ -127,7 +127,7 @@ def get_filtered_lines(file_path):
127127
),
128128
],
129129
)
130-
def test_hlo_diff(self, test_id, config_file, overrides):
130+
def test_hlo_diff(self, test_id, model_name, overrides):
131131
"""Test HLO diff for parameterized configurations."""
132132
local_landing_dir = os.path.join(os.path.dirname(__file__), f"hlo_diff_dump_{test_id}")
133133

@@ -138,12 +138,16 @@ def test_hlo_diff(self, test_id, config_file, overrides):
138138

139139
try:
140140
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
141-
config_path = os.path.join(base_dir, config_file)
141+
# Load via base.yml + model_name, the normal training path: pyconfig resolves the model
142+
# yml from model_name and merges it onto base.yml. Loading the model yml directly as the
143+
# top-level config skips base.yml, leaving logical_axis_rules empty.
144+
base_config_path = os.path.join(base_dir, "src/maxtext/configs/base.yml")
142145

143146
# Arguments for train_compile
144147
test_args = [
145148
None,
146-
config_path,
149+
base_config_path,
150+
f"model_name={model_name}",
147151
"dataset_type=synthetic",
148152
"override_model_config=true",
149153
"compile_topology_num_slices=1",

tests/utils/reference_hlo_deepseek3.txt

Lines changed: 1582 additions & 1582 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)