Commit 49d635d
Add TBE data configuration reporter to TBE forward (v3) (pytorch#4672)
Summary:
X-link: facebookresearch/FBGEMM#1703
Pull Request resolved: pytorch#4672
X-link: facebookresearch/FBGEMM#1516
Pull Request resolved: pytorch#4455
Re-land attempt of D75462895
# Add TBE data configuration reporter to TBE forward call.
The reporter reports TBE data configuration at the `SplitTableBatchedEmbeddingBagsCodegen` ***forward*** call. The output is a `TBEDataConfig` object, which is written to a JSON file(s). The configuration of its environment variables and an example of its usage is described below.
## Just Knobs for enablement
- fbgemm_gpu/features:TBE_REPORT_INPUT_PARAMS is added for enablement of the reporter (https://www.internalfb.com/intern/justknobs/?name=fbgemm_gpu%2Ffeatures)
- Default is set to `False`, enable this flag to enable reporter.
- To enable it locally use:
```
jk canary set fbgemm_gpu/features:TBE_REPORT_INPUT_PARAMS --on --ttl 600
```
## Environment Variables
---------------------
The Reporter relies on several environment variables to control its behavior. Below is a description of each variable:
- **FBGEMM_REPORT_INPUT_PARAMS_INTERVAL**:
- **Description**: Determines the interval at which reports are generated. This is specified in terms of the number of iterations.
- **Example Value**: `1` (report every iteration)
- **FBGEMM_REPORT_INPUT_PARAMS_ITER_START**:
- ***Description**: Specifies the start of the iteration range to capture reports. Default 0.
- ***Example Value**: `0` (start reporting from the first iteration)
- **FBGEMM_REPORT_INPUT_PARAMS_ITER_END**:
- ***Description**: Specifies the end of the iteration range to capture reports. Use `-1` to report until the last iteration. Default -1.
- ***Example Value**: `-1` (report until the last iteration)
- **FBGEMM_REPORT_INPUT_PARAMS_BUCKET**:
* **Description**: Specifies the name of the Manifold bucket where the report data will be saved.
* **Example Value**: `tlparse_reports`
- **FBGEMM_REPORT_INPUT_PARAMS_PATH_PREFIX**:
- **Description**: Defines the path prefix where the report files will be stored. Path will be created if not exist.
- **Example Value**: `tree/tests/`
## Use Cases
- FileStore
- General
- Auto-create output directories if not exist.
- fb-internal:
- Only export to manifold.
- Assert error, if the flag is set but failed to initialize manifold connection. (missing backend or manifold bucket is not exist)
- OSS
- Will use local FileStore to store the output
## Example Usage
-------------
Below is an example command demonstrating how to use the FBGEMM Reporter with specific environment variable settings:
```
FBGEMM_REPORT_INPUT_PARAMS_INTERVAL=2 FBGEMM_REPORT_INPUT_PARAMS_ITER_START=3
FBGEMM_REPORT_INPUT_PARAMS_BUCKET=tlparse_reports FBGEMM_REPORT_INPUT_PARAMS_PATH_PREFIX=tree/tests/ buck2 run mode/opt //deeplearning/fbgemm/fbgemm_gpu/bench:split_table_batched_embeddings -- device --iters 2
```
**Explanation**
The above setting will report `iter 3` and `iter 5`
* **FBGEMM_REPORT_INPUT_PARAMS_INTERVAL=2**: The reporter will generate a report every 2 iterations.
* **FBGEMM_REPORT_INPUT_PARAMS_ITER_START=0**: The reporter will start generating reports from the first iteration.
* **FBGEMM_REPORT_INPUT_PARAMS_ITER_END=-1 (Default)**: The reporter will continue to generate reports until the last iteration interval.
* **FBGEMM_REPORT_INPUT_PARAMS_BUCKET=tlparse_reports**: The reports will be saved in the `tlparse_reports` bucket.
* **FBGEMM_REPORT_INPUT_PARAMS_PATH_PREFIX=tree/tests/**: The reports will be stored with the path prefix `tree/tests/`. For Manifold make sure all folders within the path exist.
**Note on Benchmark example**
Note that with the `--iters 2` option, the benchmark will execute 6 forward calls (2 iterations plus 1 warmup) for the forward benchmark and another 3 calls (2 iterations plus 1 warmup) for the backward benchmark. Iteration starts from 0.
---
---
## Other includes changes in this Diff:
- Updates build dependency of tbe_data_config* files
- Remove `shutil` and `numpy.random` lib as it cause uncompatiblity error.
- Add non-OSS test, writing extracted config data json file to Manifold
Reviewed By: q10, spcyppt
Differential Revision: D797586031 parent 699954b commit 49d635d
File tree
2 files changed
+144
-0
lines changed- fbgemm_gpu
- fbgemm_gpu
- test/tbe/stats
2 files changed
+144
-0
lines changedLines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1441 | 1441 | | |
1442 | 1442 | | |
1443 | 1443 | | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
1444 | 1449 | | |
1445 | 1450 | | |
1446 | 1451 | | |
| |||
1953 | 1958 | | |
1954 | 1959 | | |
1955 | 1960 | | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
1956 | 1974 | | |
1957 | 1975 | | |
1958 | 1976 | | |
| |||
3829 | 3847 | | |
3830 | 3848 | | |
3831 | 3849 | | |
| 3850 | + | |
| 3851 | + | |
| 3852 | + | |
| 3853 | + | |
| 3854 | + | |
| 3855 | + | |
| 3856 | + | |
| 3857 | + | |
| 3858 | + | |
| 3859 | + | |
| 3860 | + | |
| 3861 | + | |
| 3862 | + | |
| 3863 | + | |
| 3864 | + | |
| 3865 | + | |
| 3866 | + | |
| 3867 | + | |
| 3868 | + | |
| 3869 | + | |
| 3870 | + | |
| 3871 | + | |
| 3872 | + | |
| 3873 | + | |
3832 | 3874 | | |
3833 | 3875 | | |
3834 | 3876 | | |
| |||
Lines changed: 102 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| 44 | + | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| |||
147 | 151 | | |
148 | 152 | | |
149 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
150 | 252 | | |
151 | 253 | | |
152 | 254 | | |
0 commit comments