Skip to content

Commit aca1bbf

Browse files
whoozlegeorgepaw
authored andcommitted
Add more tiles for wide const expansion test
Summary: This commit improves reliability of wide const expansion tests by providing more tiles for them, raising number of tiles to 128 instead of default 8. Use hardware allocation by setting compile_ipu_code. Ref T56588. Test Plan: CI, adjusted bounds Reviewers: #tensorflow, #framework_ip_review_-_any_oss_or_third-party_code_use_has_been_approved, georgep, samuelh, babakk Reviewed By: #tensorflow, #framework_ip_review_-_any_oss_or_third-party_code_use_has_been_approved, georgep Maniphest Tasks: T56588 Differential Revision: https://phabricator.sourcevertex.net/D62682
1 parent db44f89 commit aca1bbf

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

tensorflow/compiler/plugin/poplar/tests/wide_const_expansion_test.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def testCheckMaxTileSize(self):
4242
cfg = IPUConfig()
4343
report_helper = tu.ReportHelper()
4444
report_helper.set_autoreport_options(cfg)
45-
cfg.ipu_model.compile_ipu_code = False
45+
cfg.ipu_model.compile_ipu_code = True
46+
cfg.ipu_model.tiles_per_ipu = 128
4647
cfg.configure_ipu_system()
4748

4849
with self.session() as sess:
@@ -62,20 +63,21 @@ def testCheckMaxTileSize(self):
6263
sess.run(variables.global_variables_initializer())
6364

6465
report = pva.openReport(report_helper.find_report())
65-
self.assert_max_tile_memory(report, 1081548)
66+
self.assert_max_tile_memory(report, 71020)
6667
report_helper.clear_reports()
6768

6869
out = sess.run(output, {pb: np.ones(shape=shape, dtype=dtype)})
6970
self.assertAllClose(np.full(shape, 7, dtype=dtype), out)
7071

7172
report = pva.openReport(report_helper.find_report())
72-
self.assert_max_tile_memory(report, 3195324)
73+
self.assert_max_tile_memory(report, 203950)
7374

7475
def testWideConstantWithAllocationTarget(self):
7576
cfg = IPUConfig()
7677
report_helper = tu.ReportHelper()
7778
report_helper.set_autoreport_options(cfg)
78-
cfg.ipu_model.compile_ipu_code = False
79+
cfg.ipu_model.compile_ipu_code = True
80+
cfg.ipu_model.tiles_per_ipu = 128
7981
cfg.configure_ipu_system()
8082

8183
with self.session() as sess:
@@ -115,14 +117,15 @@ def body(i, x, y):
115117
'Mean/multiply', 'add', 'add_*/fusion/Op/Add'
116118
]
117119
self.assert_all_compute_sets_and_list(report, ok)
118-
self.assert_max_tile_memory(report, 1052184, tolerance=0.2)
119-
self.assert_always_live_memory(report, 2908, tolerance=0.2)
120+
self.assert_max_tile_memory(report, 68852, tolerance=0.1)
121+
self.assert_always_live_memory(report, 349916, tolerance=0.1)
120122

121123
def testCheckMaxTileSizePadding(self):
122124
cfg = IPUConfig()
123125
report_helper = tu.ReportHelper()
124126
report_helper.set_autoreport_options(cfg)
125-
cfg.ipu_model.compile_ipu_code = False
127+
cfg.ipu_model.compile_ipu_code = True
128+
cfg.ipu_model.tiles_per_ipu = 128
126129
cfg.configure_ipu_system()
127130

128131
with self.session() as sess:
@@ -153,13 +156,14 @@ def my_graph(a, b):
153156
self.assertAllClose(np.zeros(pb.shape), out[0])
154157

155158
report = pva.openReport(report_helper.find_report())
156-
self.assert_max_tile_memory(report, 1977338)
159+
self.assert_max_tile_memory(report, 534373)
157160

158161
def testCheckMaxTileSizePadding2(self):
159162
cfg = IPUConfig()
160163
report_helper = tu.ReportHelper()
161164
report_helper.set_autoreport_options(cfg)
162-
cfg.ipu_model.compile_ipu_code = False
165+
cfg.ipu_model.compile_ipu_code = True
166+
cfg.ipu_model.tiles_per_ipu = 128
163167
cfg.configure_ipu_system()
164168

165169
with self.session() as sess:
@@ -188,7 +192,7 @@ def my_graph(a, b):
188192
self.assertAllClose(np.full(pb.shape, 65.0), out[0])
189193

190194
report = pva.openReport(report_helper.find_report())
191-
self.assert_max_tile_memory(report, 260668, tolerance=0.2)
195+
self.assert_max_tile_memory(report, 23850, tolerance=0.1)
192196

193197

194198
if __name__ == "__main__":

0 commit comments

Comments
 (0)