Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cleanup] removing global compiler configuration #1174

Merged
merged 1 commit into from
Feb 7, 2025
Merged

Conversation

pilkicTT
Copy link
Contributor

@pilkicTT pilkicTT commented Feb 4, 2025

This is a part of ongoing effort to remove any global state left over from pybuda.

There should be no need of having global configuration of compiler. If user wants to override some of the exposed settings, it should be done locally, by creating a new (default) config and then passing it into the compile function. All tests which need to modify the config should do the same.

No feature should rely on reading from a "volatile global configuration". Instead, each feature must either be designed to receive the user-specified compiler configuration directly or defer config-dependent decisions for later (until the compilation stage where the appropriate configuration is available).

In majority of the cases i would assume that direct access to the user passed config is easily available.

Closes #147

@pilkicTT
Copy link
Contributor Author

pilkicTT commented Feb 4, 2025

@vbrkicTT @chandrasekaranpradeep
In this change, i am removing the global compiler config. Are you aware if this can break your features (test sweeps/model analysis)? I haven't got around to testing them, yet...

Also, it would be great if you added some simple sanity tests for both test sweeps and model analysis so that we can run it on push CI, increasing the likelihood that they won't be broken.

compiler_cfg.input_queues_on_host = input_source_flag.input_queues_on_host
if input_source_flag.set_default_dram_parameters:
compiler_cfg.default_dram_parameters = input_source_flag.default_dram_parameters
raise NotImplementedError("set_input_source is not implemented")

@staticmethod
def set_math_fidelity(math_fidelity: MathFidelity):
"""Set compiler configuration for math fidelity"""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vbrkicTT are you currently using this code path?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in sweep tests we are currently using setting of input_queues_on_host and default_dram_parameters.
Since it's not supported in Forge, it's safe to just skip this step.

@nvukobratTT @dgolubovicTT We may rethink if we need both input sources FROM_HOST vs FROM_DRAM_QUEUE. They use the same model it's just this config which is different.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put this as a topic to confirm. Right now we're in process of changing where and how our inputs are stored, and planing how we're going to handle them in the future. Once we come to reasonable conclusions, we should update this part as well.

Copy link
Contributor

@vbrkicTT vbrkicTT Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, for new we can keep behavior of sweep tests the same.

@pilkicTT @nvukobratTT Adaptation to the change for sweep tests is prepared in #1195, and can go sometime after this PR as a follow-up

forge/test/conftest.py Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Feb 4, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests510 ran451 passed59 skipped0 failed
TestResult
No test annotations available

1 similar comment
Copy link

github-actions bot commented Feb 4, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests510 ran451 passed59 skipped0 failed
TestResult
No test annotations available

Copy link

github-actions bot commented Feb 4, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests568 ran489 passed79 skipped0 failed
TestResult
No test annotations available

1 similar comment
Copy link

github-actions bot commented Feb 4, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests568 ran489 passed79 skipped0 failed
TestResult
No test annotations available

@chandrasekaranpradeep
Copy link
Contributor

@vbrkicTT @chandrasekaranpradeep In this change, i am removing the global compiler config. Are you aware if this can break your features (test sweeps/model analysis)? I haven't got around to testing them, yet...

Also, it would be great if you added some simple sanity tests for both test sweeps and model analysis so that we can run it on push CI, increasing the likelihood that they won't be broken.

Sure I will create a sanity test for model analysis and add it in push pipeline

chandrasekaranpradeep added a commit that referenced this pull request Feb 6, 2025
The PR removes the dependency of model analysis pipeline on global
compiler config.

The `compiler_cfg.tvm_generate_unique_ops_tests` and
`compiler_cfg.extract_tvm_unique_ops_config` compiler config are used
for extracting the unique ops configuration from TVM and generate unique
ops test for extracted configuration.

The `compiler_cfg.tvm_generate_unique_ops_tests` and
`compiler_cfg.extract_tvm_unique_ops_config` compiler config are enabled
through `initialize_global_compiler_configuration_based_on_pytest_args`
fixture in `forge/test/conftest.py` file by specifying the
`--generate-unique-ops-tests` or `--extract-tvm-unique-ops-config`
pytest options while running the models test


Since [this PR](#1174)
remove the global compiler configuration, removed the dependency of
enabling `compiler_cfg.tvm_generate_unique_ops_tests` and
`compiler_cfg.extract_tvm_unique_ops_config` compiler config through
`--generate-unique-ops-tests` or `--extract-tvm-unique-ops-config`
pytest options and now the `compiler_cfg.tvm_generate_unique_ops_tests`
and `compiler_cfg.extract_tvm_unique_ops_config` compiler config are
enabled through **FORGE_TVM_GENERATE_UNIQUE_OPS_TESTS** or
**FORGE_EXTRACT_TVM_UNIQUE_OPS_CONFIG** environment variable
@pilkicTT pilkicTT force-pushed the pilkic/compiler-cfg branch from 7d2a7d7 to c2cda48 Compare February 7, 2025 06:52
Copy link

github-actions bot commented Feb 7, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests590 ran465 passed125 skipped0 failed
TestResult
No test annotations available

1 similar comment
Copy link

github-actions bot commented Feb 7, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests590 ran465 passed125 skipped0 failed
TestResult
No test annotations available

Copy link

github-actions bot commented Feb 7, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests648 ran508 passed140 skipped0 failed
TestResult
No test annotations available

1 similar comment
Copy link

github-actions bot commented Feb 7, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests648 ran508 passed140 skipped0 failed
TestResult
No test annotations available

@pilkicTT pilkicTT force-pushed the pilkic/compiler-cfg branch from c2cda48 to 637149d Compare February 7, 2025 09:21
Copy link

github-actions bot commented Feb 7, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests590 ran465 passed125 skipped0 failed
TestResult
No test annotations available

Copy link

github-actions bot commented Feb 7, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests648 ran508 passed140 skipped0 failed
TestResult
No test annotations available

Copy link

github-actions bot commented Feb 7, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests590 ran465 passed125 skipped0 failed
TestResult
No test annotations available

Copy link

github-actions bot commented Feb 7, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests648 ran508 passed140 skipped0 failed
TestResult
No test annotations available

compiler_cfg.input_queues_on_host = input_source_flag.input_queues_on_host
if input_source_flag.set_default_dram_parameters:
compiler_cfg.default_dram_parameters = input_source_flag.default_dram_parameters
raise NotImplementedError("set_input_source is not implemented")

@staticmethod
def set_math_fidelity(math_fidelity: MathFidelity):
"""Set compiler configuration for math fidelity"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put this as a topic to confirm. Right now we're in process of changing where and how our inputs are stored, and planing how we're going to handle them in the future. Once we come to reasonable conclusions, we should update this part as well.

forge/forge/config.py Outdated Show resolved Hide resolved
This is a part of ongoing effort to remove any global state left over
from pybuda.

There should be no need of having global configuration of compiler. If
user wants to override some of the exposed settings, it should be done
locally, by creating a new (default) config and then passing it into the
compile function. All tests which need to modify the config should do
the same.

No feature should rely on reading from a "volatile global
configuration". Instead, each feature must either be designed to receive
the user-specified compiler configuration directly or defer
config-dependent decisions for later (until the compilation stage where
the appropriate configuration is available).

In majority of the cases I would assume that direct access to the user
passed config is easily available.

Closes #147
Copy link

github-actions bot commented Feb 7, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests590 ran465 passed125 skipped0 failed
TestResult
No test annotations available

1 similar comment
Copy link

github-actions bot commented Feb 7, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests590 ran465 passed125 skipped0 failed
TestResult
No test annotations available

Copy link

github-actions bot commented Feb 7, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests648 ran508 passed140 skipped0 failed
TestResult
No test annotations available

Copy link

github-actions bot commented Feb 7, 2025

TestsPassed ✅Skipped ⚠️Failed
TT-Forge-FE Tests648 ran508 passed140 skipped0 failed
TestResult
No test annotations available

@pilkicTT pilkicTT merged commit 74704d2 into main Feb 7, 2025
10 checks passed
@pilkicTT pilkicTT deleted the pilkic/compiler-cfg branch February 7, 2025 12:12
vbrkicTT added a commit that referenced this pull request Feb 7, 2025
### Ticket

Fix for #147 

### Problem description
Global compiler configuration completely removed in #1174.
Parameters input_queues_on_host and default_dram_parameters removed.
Parameter default_math_fidelity still exists, though still not
respected.

### What's changed
Maintain (instantiate and pass) CompilerConfig through sweep test
verification.

### Checklist
- [ ] New/Existing tests provide coverage for changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[compile] remove global compiler configuration
4 participants