all.T 15 KB
Newer Older
1 2
# Tests that newArray/newArray_ is being optimised correctly

Simon Peyton Jones's avatar
Simon Peyton Jones committed
3 4 5
test('T10359',
     [stats_num_field('bytes allocated',
          [(wordsize(64), 499512, 5),
Simon Peyton Jones's avatar
Simon Peyton Jones committed
6
           (wordsize(32), 374056, 5)]),
Simon Peyton Jones's avatar
Simon Peyton Jones committed
7 8 9 10 11
      only_ways(['normal'])
      ],
     compile_and_run,
     ['-O'])

12 13
# fortunately the values here are mostly independent of the wordsize,
# because the test allocates an unboxed array of doubles.
14
test('T3586',
15 16
     [stats_num_field('peak_megabytes_allocated', (17, 1)),
                                 # expected value: 17 (amd64/Linux)
17 18 19
      stats_num_field('bytes allocated', (16102024, 5)),
                        # prev:           16835544 (amd64/Linux)
                        # 2014-07-17:     16102024 (amd64/Linux), general round of updates
20 21 22 23 24
      only_ways(['normal']),

      # Use `+RTS -G1` for more stable residency measurements. Note [residency].
      # Only 64-bit as we don't have a good 32-bit test environment at the moment
      when(wordsize(64), extra_hc_opts('+RTS -G1 -RTS'))
25 26 27
      ],
     compile_and_run,
     ['-O'])
Simon Peyton Jones's avatar
Simon Peyton Jones committed
28

Simon Peyton Jones's avatar
Simon Peyton Jones committed
29
test('T4830',
ian@well-typed.com's avatar
ian@well-typed.com committed
30
     [stats_num_field('bytes allocated',
31
          [(wordsize(64), 98248, 4),
ian@well-typed.com's avatar
ian@well-typed.com committed
32 33
           #             127000 (amd64/Linux)
           # 2013-02-07:  99264 (amd64/Linux)
34
           # 2014-01-13:  98248 (amd64/Linux) due to #8647
35
           # 2015-04-03: Widen 1->4% (amd64/Windows was doing better)
36
           (wordsize(32), 70646, 3)]),
ian@well-typed.com's avatar
ian@well-typed.com committed
37 38
           # 2013-02-10:  69744 (x86/Windows)
           # 2013-02-10:  71548 (x86/OSX)
39 40
           # 2014-01-28:  Widen range 2->3
           #                (x86/Windows - actual 69000, lower was 69233)
Simon Peyton Jones's avatar
Simon Peyton Jones committed
41 42 43 44 45
      only_ways(['normal'])
      ],
     compile_and_run,
     ['-O2'])

46 47
test('T3245', [when(doing_ghci(), extra_hc_opts('-fobject-code'))],
     compile_and_run, ['-O'])
48 49 50 51 52

# Test that bytestring reading/writing isn't over-allocating.  We had
# a bug in hGetBufNonBlocking in 6.13 that triggered this.
#
test('lazy-bs-alloc',
53 54
     [stats_num_field('peak_megabytes_allocated', (2, 1)),
                                 # expected value: 2 (amd64/Linux)
ian@well-typed.com's avatar
ian@well-typed.com committed
55
      stats_num_field('bytes allocated',
56
          [(wordsize(64), 425400, 3),
ian@well-typed.com's avatar
ian@well-typed.com committed
57 58
            #             489776 (amd64/Linux)
            # 2013-02-07: 429744 (amd64/Linux)
59
            # 2013-12-12: 425400 (amd64/Linux)
60
            # 2015-04-04: Widen 1->3% (amd64/Windows was failing)
61
           (wordsize(32), 411500, 2)]),
ian@well-typed.com's avatar
ian@well-typed.com committed
62 63
            # 2013-02-10: 421296 (x86/Windows)
            # 2013-02-10: 414180 (x86/OSX)
64
            # 2014-01-22: 411500 (x86/Linux)
65
            # 2014-01-28: Widen 1->2% (x86/Windows was at 425212)
66 67
      only_ways(['normal']),
      extra_run_opts('../../numeric/should_run/arith011.stdout'),
68 69 70 71 72
      ignore_output,

      # Use `+RTS -G1` for more stable residency measurements. Note [residency].
      # Only 64-bit as we don't have a good 32-bit test environment at the moment
      when(wordsize(64), extra_hc_opts('+RTS -G1 -RTS'))
73
      ],
74
     # use a suitably big file, without bloating the repo with a new one:
75 76
     compile_and_run,
     ['-O'])
Ian Lynagh's avatar
Ian Lynagh committed
77

Simon Peyton Jones's avatar
Simon Peyton Jones committed
78 79
test('T876',
     [stats_num_field('bytes allocated',
80 81 82
          [(platform('x86_64-unknown-mingw32'), 71904, 5),
              # 2015-04-03: 71904 (amd64/Windows, unknown cause)
           (wordsize(64), 63216 , 5),
Simon Peyton Jones's avatar
Simon Peyton Jones committed
83
              # 2013-02-14: 1263712 (x86_64/Linux)
84
              # 2014-02-10:   63216 (x86_64/Linux), call arity analysis
85 86

           (wordsize(32), 56796, 5) ]),
87 88
              # some date:  663712  (Windows, 64-bit machine)
              # 2014-04-04:  56820  (Windows, 64-bit machine)
89
              # 2014-06-29:  53024  (x86_64/Linux)
90 91
              # 2014-12-01:  56796  (Windows)

Simon Peyton Jones's avatar
Simon Peyton Jones committed
92 93 94 95 96 97
      only_ways(['normal']),
      extra_run_opts('10000')
      ],
     compile_and_run,
     ['-O'])

98 99 100 101 102 103
# Get reproducible floating-point results on x86
if config.arch == 'i386':
   sse2_opts = '-msse2'
else:
   sse2_opts = ''

Ian Lynagh's avatar
Ian Lynagh committed
104
test('T4321',
Simon Peyton Jones's avatar
Simon Peyton Jones committed
105
     omit_ways(['ghci']),
Ian Lynagh's avatar
Ian Lynagh committed
106
     compile_and_run, ['-O ' + sse2_opts])
107

108 109 110 111
test('T3736',
     extra_clean(['T3736.speed.f32']),
     run_command,
     ['$MAKE -s --no-print-directory T3736'])
Ian Lynagh's avatar
Ian Lynagh committed
112
test('T3738',
Ian Lynagh's avatar
Ian Lynagh committed
113
     [extra_clean(['T3738a.hi', 'T3738a.o']),
114 115
      stats_num_field('peak_megabytes_allocated', (1, 0)),
                                 # expected value: 1 (amd64/Linux)
116 117
      stats_num_field('bytes allocated',
                      [(wordsize(32), 45648, 5),
118
                    # expected value: 50520 (x86/Linux)
119
                       (wordsize(64), 50592, 8)]),
120 121
                    # prev:           49400 (amd64/Linux)
                    # 2014-07-17:     50520 (amd64/Linux) general round of updates
Joachim Breitner's avatar
Joachim Breitner committed
122
                    # 2014-09-10:     50592 (amd64/Linux) post-AMP-update
123
                    # 2015-04-03: Widen 5->8% (amd64/Windows was doing better)
Ian Lynagh's avatar
Ian Lynagh committed
124 125 126 127
      only_ways(['normal'])
      ],
     compile_and_run,
     ['-O'])
Ian Lynagh's avatar
Ian Lynagh committed
128

Simon Peyton Jones's avatar
Simon Peyton Jones committed
129
test('MethSharing',
130 131
     [stats_num_field('peak_megabytes_allocated', (1, 0)),
                                 # expected value: 1 (amd64/Linux)
132
      stats_num_field('bytes allocated',
133 134 135 136 137
                      [(wordsize(32), 360940756, 5),
                    # expected value: 2685858140 (x86/OS X)
                          # expected: 360940756 (x86/Linux)
                       (wordsize(64), 640067672, 5)]),
                          # expected: 640067672 (amd64/Linux)
Simon Peyton Jones's avatar
Simon Peyton Jones committed
138 139 140 141
      only_ways(['normal'])
      ],
     compile_and_run,
     ['-O'])
Ian Lynagh's avatar
Ian Lynagh committed
142
test('T2902',
143 144 145 146 147 148 149
     extra_clean(['T2902_A',    'T2902_B',
                  'T2902_A.hi', 'T2902_B.hi',
                  'T2902_A.o',  'T2902_B.o',
                  'T2902_A_PairingSum.hi', 'T2902_B_PairingSum.hi',
                  'T2902_A_PairingSum.o',  'T2902_B_PairingSum.o',
                  'T2902_Sum.hi',
                  'T2902_Sum.o']),
Ian Lynagh's avatar
Ian Lynagh committed
150 151
     run_command,
     ['$MAKE -s --no-print-directory T2902'])
152
test('T149',
Simon Marlow's avatar
Simon Marlow committed
153 154
     [ # expect_broken(149),
       # working (2 Jul 2013, x86-64/Linux)
155 156 157 158 159
      extra_clean(['T149_A',    'T149_B',
                   'T149_A.hi', 'T149_B.hi',
                   'T149_A.o',  'T149_B.o'])],
     run_command,
     ['$MAKE -s --no-print-directory T149'])
Ian Lynagh's avatar
Ian Lynagh committed
160

Simon Peyton Jones's avatar
Simon Peyton Jones committed
161
test('T5113',
162 163 164
     [stats_num_field('bytes allocated',
                      [(wordsize(32), 4000000, 5),
                       (wordsize(64), 8000000, 5)]),
Simon Peyton Jones's avatar
Simon Peyton Jones committed
165
      only_ways(['normal'])
Simon Peyton Jones's avatar
Simon Peyton Jones committed
166 167 168 169
      ],
     compile_and_run,
     ['-O'])

170 171

test('T4978',
172 173 174 175
     [stats_num_field('bytes allocated',
                      [(wordsize(32), 10000000, 5),
                       (wordsize(64), 10137680, 5)]),
                    # expected value: 10137680 (amd64/Linux)
176 177 178 179
      only_ways(['normal'])
      ],
     compile_and_run,
     ['-O2'])
Ian Lynagh's avatar
Ian Lynagh committed
180 181

test('T5205',
182 183 184
     [stats_num_field('bytes allocated',
                      [(wordsize(32), 47088, 5),
                    # expected value: 47088 (x86/Darwin)
185
                       (wordsize(64), 52600, 7)]),
186
                    # expected value: 51320 (amd64/Linux)
187
                    # 2014-07-17:     52600 (amd64/Linux) general round of updates
188
                    # 2015-04-03: Widen 5->7% (amd64/Windows was doing better)
189
      only_ways(['normal', 'optasm'])
Ian Lynagh's avatar
Ian Lynagh committed
190 191
      ],
     compile_and_run,
192
     [''])
Ian Lynagh's avatar
Ian Lynagh committed
193

Simon Peyton Jones's avatar
Simon Peyton Jones committed
194
test('T5549',
195
     [stats_num_field('bytes allocated',
196
                      [(wordsize(32), 4096606332, 5),
197
                    # expected value: 3362958676 (Windows)
198 199
                    # 2014-12-01:     4096606332 (Windows) integer-gmp2

200
                       (wordsize(64), 8193140752, 5)]),
201
                    # expected value: 6725846120 (amd64/Linux)
202
                    #                 8193140752 (amd64/Linux) integer-gmp2
Simon Peyton Jones's avatar
Simon Peyton Jones committed
203 204 205 206 207
      only_ways(['normal'])
      ],
     compile_and_run,
     ['-O'])

Ian Lynagh's avatar
Ian Lynagh committed
208
test('T4474a',
209
     [stats_num_field('bytes allocated',
210 211 212
                      [(wordsize(32), 2405242767, 5),
                       (wordsize(64), 4831890304, 5)]),
                    # expected value: 4831890304 (amd64/OSX)
Ian Lynagh's avatar
Ian Lynagh committed
213 214 215 216 217
      only_ways(['normal'])
      ],
     compile_and_run,
     ['-O'])
test('T4474b',
218
     [stats_num_field('bytes allocated',
219 220 221
                      [(wordsize(32), 2405242767, 5),
                       (wordsize(64), 4831890304, 5)]),
                    # expected value: 4831890304 (amd64/OSX)
Ian Lynagh's avatar
Ian Lynagh committed
222 223 224 225 226
      only_ways(['normal'])
      ],
     compile_and_run,
     ['-O'])
test('T4474c',
227
     [stats_num_field('bytes allocated',
228 229 230
                      [(wordsize(32), 2405242767, 5),
                       (wordsize(64), 4831890304, 5)]),
                    # expected value: 4831890304 (amd64/OSX)
Ian Lynagh's avatar
Ian Lynagh committed
231 232 233 234 235
      only_ways(['normal'])
      ],
     compile_and_run,
     ['-O'])

daniel.is.fischer's avatar
daniel.is.fischer committed
236
test('T5237',
237
     [stats_num_field('bytes allocated',
238 239
                        [(platform('i386-unknown-mingw32'), 73280, 5),
                         (wordsize(32), 78328, 5),
240
                      # expected value: 78328 (i386/Linux)
241
                         (wordsize(64), 104176, 5)]),
242
                      # expected value: 110888 (amd64/Linux)
243
                      # expected value: 104176 (amd64/Linux)
daniel.is.fischer's avatar
daniel.is.fischer committed
244 245 246 247
     only_ways(['normal'])
     ],
    compile_and_run,
    ['-O ' + sse2_opts])
Ian Lynagh's avatar
Ian Lynagh committed
248 249

test('T5536',
250
     [stats_num_field('bytes allocated',
ian@well-typed.com's avatar
ian@well-typed.com committed
251 252 253 254
                      [(wordsize(32), 446260520, 1),
                                   # 1246287228 (i386/Linux)
                                    # 446328556 (i386/Windows)
                                    # 446192484 (i386/OSX)
255 256 257 258
                       (wordsize(64), 892399040, 5)]),
                   # expected value: 2492589480 (amd64/Linux)
                   # 17/1/13:         892399040 (x86_64/Linux)
                   #                  (new demand analyser)
Ian Lynagh's avatar
Ian Lynagh committed
259 260 261 262 263 264 265
     extra_clean(['T5536.data']),
     ignore_output,
     only_ways(['normal'])
     ],
    compile_and_run,
    ['-O'])

Simon Marlow's avatar
Simon Marlow committed
266
test('T7257',
267 268 269 270 271 272 273 274 275 276
     [stats_num_field('bytes allocated',
                      [(wordsize(32), 1150000000, 10),
                    # expected value: 1246287228 (i386/Linux)
                       (wordsize(64), 1774893760, 5)]),
                        # 2012-09-21: 1774893760 (amd64/Linux)
      stats_num_field('peak_megabytes_allocated',
                      [(wordsize(32), 217, 5),
                        # 2012-10-08: 217 (x86/Linux)
                       (wordsize(64), 227, 5)]),
                        # 2012-09-21: 227 (amd64/Linux)
Simon Marlow's avatar
Simon Marlow committed
277 278 279 280

      only_ways(['normal'])
     ],
    compile_and_run, ['-O'])
281 282

test('Conversions',
283
     [stats_num_field('bytes allocated',
284
                      [(wordsize(32), 76768, 3),
ian@well-typed.com's avatar
ian@well-typed.com committed
285 286 287
                        # 2012-12-18: 55316 Guessed 64-bit value / 2
                        # 2013-02-10: 77472 (x86/OSX)
                        # 2013-02-10: 79276 (x86/Windows)
288
                        # 2014-01-13: 76768 (x86/Linux) due to #8647
289
                       (wordsize(64), 107544, 5)]),
290
                        # 2012-12-18: 109608 (amd64/OS X)
291
                        # 2014-07-17: 107544 (amd64/Linux)
292 293 294

      only_ways(['normal'])
     ],
295
    compile_and_run, ['-O -msse2'])
Simon Peyton Jones's avatar
Simon Peyton Jones committed
296

Simon Peyton Jones's avatar
Simon Peyton Jones committed
297
test('T7507', omit_ways(['ghci']), compile_and_run, ['-O'])
Simon Peyton Jones's avatar
Simon Peyton Jones committed
298
# For 7507, stack overflow is the bad case
Simon Peyton Jones's avatar
Simon Peyton Jones committed
299 300

test('T7436',
ian@well-typed.com's avatar
ian@well-typed.com committed
301
     [stats_num_field('max_bytes_used',
302
          [(wordsize(64), 60360, 4),
ian@well-typed.com's avatar
ian@well-typed.com committed
303 304
           #             127000 (amd64/Linux)
           # 2013-02-07:  60360 (amd64/Linux)
305
           # 2015-04-03: Widen 1->4% (amd64/Windows was doing better)
ian@well-typed.com's avatar
ian@well-typed.com committed
306 307 308
           (wordsize(32), 58434, 1)]),
            # 2013-02-10: 58032 (x86/Windows)
            # 2013-02-10: 58836 (x86/OSX)
Simon Peyton Jones's avatar
Simon Peyton Jones committed
309 310 311 312
      only_ways(['normal'])
      ],
     compile_and_run,
     ['-O'])
Simon Peyton Jones's avatar
Simon Peyton Jones committed
313 314

test('T7797',
315
      [stats_num_field('bytes allocated',
316 317
                      [(wordsize(32), 240044984, 5),
                          # expected value: 2685858140 (x86/OS X)
Simon Peyton Jones's avatar
Simon Peyton Jones committed
318
                          # expected: 360940756 (x86/Linux)
319
                          # expected: 240044984 (x86/Windows, 64bit machine)
Simon Peyton Jones's avatar
Simon Peyton Jones committed
320 321
                       (wordsize(64), 480050944, 5)]),
                          # expected: 480050944 (amd64/Linux)
ian@well-typed.com's avatar
ian@well-typed.com committed
322
      extra_clean(['T7797a.hi', 'T7797a.o']),
Simon Peyton Jones's avatar
Simon Peyton Jones committed
323 324 325 326 327
      only_ways(['normal'])
      ],
     compile_and_run,
     ['-O'])

Simon Peyton Jones's avatar
Simon Peyton Jones committed
328
test('T7954',
329
      [stats_num_field('bytes allocated',
330 331 332
                      [(wordsize(32), 920045264, 10),
              # some date:  1380051408    (64-bit Windows machine)
              # 2014-04-04:  920045264    (64-bit Windows machine)
333 334
                       (wordsize(64), 1680051336, 10)]),
              # 2014-02-10: 1680051336 (x86_64/Linux), call arity analysis
Simon Peyton Jones's avatar
Simon Peyton Jones committed
335 336 337 338 339
      only_ways(['normal'])
      ],
     compile_and_run,
     ['-O'])

ian@well-typed.com's avatar
ian@well-typed.com committed
340
test('T7850',
341 342 343
     [stats_num_field('peak_megabytes_allocated', 
                      [(wordsize(32), 2, 10),
                       (wordsize(64), 4, 10)]),
ian@well-typed.com's avatar
ian@well-typed.com committed
344 345 346 347
      only_ways(['normal'])],
     compile_and_run,
     ['-O'])

Joachim Breitner's avatar
Joachim Breitner committed
348 349
test('T5949',
     [stats_num_field('bytes allocated',
350
                      [ (wordsize(32), 116020, 10),
351
                        (wordsize(64), 201008, 10)]),
Joachim Breitner's avatar
Joachim Breitner committed
352 353 354 355 356
                      # previously, it was >400000 bytes
      only_ways(['normal'])],
     compile_and_run,
     ['-O'])

Joachim Breitner's avatar
Joachim Breitner committed
357 358
test('T4267',
     [stats_num_field('bytes allocated',
359 360
                      [ (wordsize(32), 36012, 10)
                      # 32-bit value close to 64 bit; c.f. T7619
361
                      , (wordsize(64), 40992, 10) ]),
Joachim Breitner's avatar
Joachim Breitner committed
362
                      # previously, it was >170000 bytes
363 364
                      # 2014-01-17: 130000
                      # 2014-02-10: 40992 (x86_64/Linux), call arity analysis
Joachim Breitner's avatar
Joachim Breitner committed
365 366 367 368
      only_ways(['normal'])],
     compile_and_run,
     ['-O'])

Joachim Breitner's avatar
Joachim Breitner committed
369 370
test('T7619',
     [stats_num_field('bytes allocated',
371 372 373
                      [ (wordsize(32), 36012, 10)
                      # 32-bit close to 64-bit value; most of this very 
                      # small number is standard start-up boilerplate I think
374
                      , (wordsize(64), 40992, 10) ]),
Joachim Breitner's avatar
Joachim Breitner committed
375 376 377 378 379
                      # previously, it was >400000 bytes
      only_ways(['normal'])],
     compile_and_run,
     ['-O'])

380 381
test('InlineArrayAlloc',
     [stats_num_field('bytes allocated',
382 383
                      [ (wordsize(32), 800040960, 5)
                      , (wordsize(64), 1600040960, 5) ]),
384 385 386
      only_ways(['normal'])],
     compile_and_run,
     ['-O2'])
387 388 389

test('InlineByteArrayAlloc',
     [stats_num_field('bytes allocated',
390
                      [ (wordsize(32), 1360036012, 5)
391
                      , (wordsize(64), 1440040960, 5) ]),
392 393
         # 32 and 64 bit not so different, because 
         # we are allocating *byte* arrays
394 395 396
      only_ways(['normal'])],
     compile_and_run,
     ['-O2'])
397 398 399

test('InlineCloneArrayAlloc',
     [stats_num_field('bytes allocated',
400 401
                      [ (wordsize(32), 800041120, 5) 
                      , (wordsize(64), 1600041120, 5) ]),
402 403 404
      only_ways(['normal'])],
     compile_and_run,
     ['-O2'])
405 406 407 408

test('T9203',
     [stats_num_field('bytes allocated',
                      [ (wordsize(32), 50000000, 5)
Joachim Breitner's avatar
Joachim Breitner committed
409 410 411
                      , (wordsize(64), 94547280, 5) ]),
                      # was            95747304
                      # 2019-09-10     94547280 post-AMP cleanup
412 413 414
      only_ways(['normal'])],
     compile_and_run,
     ['-O2'])
Joachim Breitner's avatar
Joachim Breitner committed
415 416 417

test('T9339',
     [stats_num_field('bytes allocated',
418 419
                      [ (wordsize(32),    40046844, 5)
                      , (wordsize(64),    80050760, 5) ]),
Joachim Breitner's avatar
Joachim Breitner committed
420 421 422 423 424
                      # w/o fusing last: 320005080
                      # 2014-07-22:       80050760
      only_ways(['normal'])],
     compile_and_run,
     ['-O2'])