aboutsummaryrefslogtreecommitdiff
path: root/test/fuzz/transformation_set_memory_operands_mask_test.cpp
blob: 44901f9c7fe7e90021b9535380ea0cd3006ca56f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
// Copyright (c) 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "source/fuzz/transformation_set_memory_operands_mask.h"

#include "gtest/gtest.h"
#include "source/fuzz/fuzzer_util.h"
#include "source/fuzz/instruction_descriptor.h"
#include "test/fuzz/fuzz_test_util.h"

namespace spvtools {
namespace fuzz {
namespace {

TEST(TransformationSetMemoryOperandsMaskTest, PreSpirv14) {
  std::string shader = R"(
               OpCapability Shader
          %1 = OpExtInstImport "GLSL.std.450"
               OpMemoryModel Logical GLSL450
               OpEntryPoint Fragment %4 "main"
               OpExecutionMode %4 OriginUpperLeft
               OpSource ESSL 310
               OpName %4 "main"
               OpName %7 "Point3D"
               OpMemberName %7 0 "x"
               OpMemberName %7 1 "y"
               OpMemberName %7 2 "z"
               OpName %12 "global_points"
               OpName %15 "block"
               OpMemberName %15 0 "in_points"
               OpMemberName %15 1 "in_point"
               OpName %17 ""
               OpName %133 "local_points"
               OpMemberDecorate %7 0 Offset 0
               OpMemberDecorate %7 1 Offset 4
               OpMemberDecorate %7 2 Offset 8
               OpDecorate %10 ArrayStride 16
               OpMemberDecorate %15 0 Offset 0
               OpMemberDecorate %15 1 Offset 192
               OpDecorate %15 Block
               OpDecorate %17 DescriptorSet 0
               OpDecorate %17 Binding 0
          %2 = OpTypeVoid
          %3 = OpTypeFunction %2
          %6 = OpTypeFloat 32
          %7 = OpTypeStruct %6 %6 %6
          %8 = OpTypeInt 32 0
          %9 = OpConstant %8 12
         %10 = OpTypeArray %7 %9
         %11 = OpTypePointer Private %10
         %12 = OpVariable %11 Private
         %15 = OpTypeStruct %10 %7
         %16 = OpTypePointer Uniform %15
         %17 = OpVariable %16 Uniform
         %18 = OpTypeInt 32 1
         %19 = OpConstant %18 0
         %20 = OpTypePointer Uniform %10
         %24 = OpTypePointer Private %7
         %27 = OpTypePointer Private %6
         %30 = OpConstant %18 1
        %132 = OpTypePointer Function %10
        %135 = OpTypePointer Uniform %7
        %145 = OpTypePointer Function %7
          %4 = OpFunction %2 None %3
          %5 = OpLabel
        %133 = OpVariable %132 Function
         %21 = OpAccessChain %20 %17 %19
               OpCopyMemory %12 %21 Aligned 16
               OpCopyMemory %133 %12 Volatile
               OpCopyMemory %133 %12
        %136 = OpAccessChain %135 %17 %30
        %138 = OpAccessChain %24 %12 %19
               OpCopyMemory %138 %136 None
        %146 = OpAccessChain %145 %133 %30
        %147 = OpLoad %7 %146 Volatile|Nontemporal|Aligned 16
        %148 = OpAccessChain %24 %12 %19
               OpStore %148 %147 Nontemporal
               OpReturn
               OpFunctionEnd
  )";

  for (auto env :
       {SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_2,
        SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_0, SPV_ENV_VULKAN_1_1}) {
    const auto consumer = nullptr;
    const auto context =
        BuildModule(env, consumer, shader, kFuzzAssembleOption);
    spvtools::ValidatorOptions validator_options;
    ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(
        context.get(), validator_options, kConsoleMessageConsumer));
    TransformationContext transformation_context(
        MakeUnique<FactManager>(context.get()), validator_options);

#ifndef NDEBUG
    {
      // Not OK: multiple operands are not supported pre SPIR-V 1.4.
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 3),
          (uint32_t)spv::MemoryAccessMask::Nontemporal |
              (uint32_t)spv::MemoryAccessMask::Volatile,
          1);
      ASSERT_DEATH(
          transformation.IsApplicable(context.get(), transformation_context),
          "Multiple memory operand masks are not supported");
    }
#endif

    // Not OK: the instruction is not a memory access.
    ASSERT_FALSE(TransformationSetMemoryOperandsMask(
                     MakeInstructionDescriptor(21, spv::Op::OpAccessChain, 0),
                     (uint32_t)spv::MemoryAccessMask::MaskNone, 0)
                     .IsApplicable(context.get(), transformation_context));

    // Not OK to remove Aligned
    ASSERT_FALSE(TransformationSetMemoryOperandsMask(
                     MakeInstructionDescriptor(147, spv::Op::OpLoad, 0),
                     (uint32_t)spv::MemoryAccessMask::Volatile |
                         (uint32_t)spv::MemoryAccessMask::Nontemporal,
                     0)
                     .IsApplicable(context.get(), transformation_context));

    {
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(147, spv::Op::OpLoad, 0),
          (uint32_t)spv::MemoryAccessMask::Aligned |
              (uint32_t)spv::MemoryAccessMask::Volatile,
          0);
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    // Not OK to remove Aligned
    ASSERT_FALSE(TransformationSetMemoryOperandsMask(
                     MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 0),
                     (uint32_t)spv::MemoryAccessMask::MaskNone, 0)
                     .IsApplicable(context.get(), transformation_context));

    // OK: leaves the mask as is
    ASSERT_TRUE(TransformationSetMemoryOperandsMask(
                    MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 0),
                    (uint32_t)spv::MemoryAccessMask::Aligned, 0)
                    .IsApplicable(context.get(), transformation_context));

    {
      // OK: adds Nontemporal and Volatile
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 0),
          (uint32_t)spv::MemoryAccessMask::Aligned |
              (uint32_t)spv::MemoryAccessMask::Nontemporal |
              (uint32_t)spv::MemoryAccessMask::Volatile,
          0);
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    // Not OK to remove Volatile
    ASSERT_FALSE(TransformationSetMemoryOperandsMask(
                     MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 1),
                     (uint32_t)spv::MemoryAccessMask::Nontemporal, 0)
                     .IsApplicable(context.get(), transformation_context));

    // Not OK to add Aligned
    ASSERT_FALSE(TransformationSetMemoryOperandsMask(
                     MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 1),
                     (uint32_t)spv::MemoryAccessMask::Aligned |
                         (uint32_t)spv::MemoryAccessMask::Volatile,
                     0)
                     .IsApplicable(context.get(), transformation_context));

    {
      // OK: adds Nontemporal
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 1),
          (uint32_t)spv::MemoryAccessMask::Nontemporal |
              (uint32_t)spv::MemoryAccessMask::Volatile,
          0);
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    {
      // OK: adds Nontemporal (creates new operand)
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 2),
          (uint32_t)spv::MemoryAccessMask::Nontemporal |
              (uint32_t)spv::MemoryAccessMask::Volatile,
          0);
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    {
      // OK: adds Nontemporal and Volatile
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(138, spv::Op::OpCopyMemory, 0),
          (uint32_t)spv::MemoryAccessMask::Nontemporal |
              (uint32_t)spv::MemoryAccessMask::Volatile,
          0);
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    {
      // OK: removes Nontemporal, adds Volatile
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(148, spv::Op::OpStore, 0),
          (uint32_t)spv::MemoryAccessMask::Volatile, 0);
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    std::string after_transformation = R"(
                 OpCapability Shader
            %1 = OpExtInstImport "GLSL.std.450"
                 OpMemoryModel Logical GLSL450
                 OpEntryPoint Fragment %4 "main"
                 OpExecutionMode %4 OriginUpperLeft
                 OpSource ESSL 310
                 OpName %4 "main"
                 OpName %7 "Point3D"
                 OpMemberName %7 0 "x"
                 OpMemberName %7 1 "y"
                 OpMemberName %7 2 "z"
                 OpName %12 "global_points"
                 OpName %15 "block"
                 OpMemberName %15 0 "in_points"
                 OpMemberName %15 1 "in_point"
                 OpName %17 ""
                 OpName %133 "local_points"
                 OpMemberDecorate %7 0 Offset 0
                 OpMemberDecorate %7 1 Offset 4
                 OpMemberDecorate %7 2 Offset 8
                 OpDecorate %10 ArrayStride 16
                 OpMemberDecorate %15 0 Offset 0
                 OpMemberDecorate %15 1 Offset 192
                 OpDecorate %15 Block
                 OpDecorate %17 DescriptorSet 0
                 OpDecorate %17 Binding 0
            %2 = OpTypeVoid
            %3 = OpTypeFunction %2
            %6 = OpTypeFloat 32
            %7 = OpTypeStruct %6 %6 %6
            %8 = OpTypeInt 32 0
            %9 = OpConstant %8 12
           %10 = OpTypeArray %7 %9
           %11 = OpTypePointer Private %10
           %12 = OpVariable %11 Private
           %15 = OpTypeStruct %10 %7
           %16 = OpTypePointer Uniform %15
           %17 = OpVariable %16 Uniform
           %18 = OpTypeInt 32 1
           %19 = OpConstant %18 0
           %20 = OpTypePointer Uniform %10
           %24 = OpTypePointer Private %7
           %27 = OpTypePointer Private %6
           %30 = OpConstant %18 1
          %132 = OpTypePointer Function %10
          %135 = OpTypePointer Uniform %7
          %145 = OpTypePointer Function %7
            %4 = OpFunction %2 None %3
            %5 = OpLabel
          %133 = OpVariable %132 Function
           %21 = OpAccessChain %20 %17 %19
                 OpCopyMemory %12 %21 Aligned|Nontemporal|Volatile 16
                 OpCopyMemory %133 %12 Nontemporal|Volatile
                 OpCopyMemory %133 %12 Nontemporal|Volatile
          %136 = OpAccessChain %135 %17 %30
          %138 = OpAccessChain %24 %12 %19
                 OpCopyMemory %138 %136 Nontemporal|Volatile
          %146 = OpAccessChain %145 %133 %30
          %147 = OpLoad %7 %146 Aligned|Volatile 16
          %148 = OpAccessChain %24 %12 %19
                 OpStore %148 %147 Volatile
                 OpReturn
                 OpFunctionEnd
    )";
    ASSERT_TRUE(IsEqual(env, after_transformation, context.get()));
  }
}

TEST(TransformationSetMemoryOperandsMaskTest, Spirv14OrHigher) {
  std::string shader = R"(
               OpCapability Shader
          %1 = OpExtInstImport "GLSL.std.450"
               OpMemoryModel Logical GLSL450
               OpEntryPoint Fragment %4 "main" %12 %17
               OpExecutionMode %4 OriginUpperLeft
               OpSource ESSL 310
               OpName %4 "main"
               OpName %7 "Point3D"
               OpMemberName %7 0 "x"
               OpMemberName %7 1 "y"
               OpMemberName %7 2 "z"
               OpName %12 "global_points"
               OpName %15 "block"
               OpMemberName %15 0 "in_points"
               OpMemberName %15 1 "in_point"
               OpName %17 ""
               OpName %133 "local_points"
               OpMemberDecorate %7 0 Offset 0
               OpMemberDecorate %7 1 Offset 4
               OpMemberDecorate %7 2 Offset 8
               OpDecorate %10 ArrayStride 16
               OpMemberDecorate %15 0 Offset 0
               OpMemberDecorate %15 1 Offset 192
               OpDecorate %15 Block
               OpDecorate %17 DescriptorSet 0
               OpDecorate %17 Binding 0
          %2 = OpTypeVoid
          %3 = OpTypeFunction %2
          %6 = OpTypeFloat 32
          %7 = OpTypeStruct %6 %6 %6
          %8 = OpTypeInt 32 0
          %9 = OpConstant %8 12
         %10 = OpTypeArray %7 %9
         %11 = OpTypePointer Private %10
         %12 = OpVariable %11 Private
         %15 = OpTypeStruct %10 %7
         %16 = OpTypePointer Uniform %15
         %17 = OpVariable %16 Uniform
         %18 = OpTypeInt 32 1
         %19 = OpConstant %18 0
         %20 = OpTypePointer Uniform %10
         %24 = OpTypePointer Private %7
         %27 = OpTypePointer Private %6
         %30 = OpConstant %18 1
        %132 = OpTypePointer Function %10
        %135 = OpTypePointer Uniform %7
        %145 = OpTypePointer Function %7
          %4 = OpFunction %2 None %3
          %5 = OpLabel
        %133 = OpVariable %132 Function
         %21 = OpAccessChain %20 %17 %19
               OpCopyMemory %12 %21 Aligned 16 Nontemporal|Aligned 16
               OpCopyMemory %133 %12 Volatile
               OpCopyMemory %133 %12
               OpCopyMemory %133 %12
        %136 = OpAccessChain %135 %17 %30
        %138 = OpAccessChain %24 %12 %19
               OpCopyMemory %138 %136 None Aligned 16
               OpCopyMemory %138 %136 Aligned 16
        %146 = OpAccessChain %145 %133 %30
        %147 = OpLoad %7 %146 Volatile|Nontemporal|Aligned 16
        %148 = OpAccessChain %24 %12 %19
               OpStore %148 %147 Nontemporal
               OpReturn
               OpFunctionEnd
  )";

  for (auto env : {SPV_ENV_UNIVERSAL_1_4, SPV_ENV_UNIVERSAL_1_5,
                   SPV_ENV_VULKAN_1_1_SPIRV_1_4, SPV_ENV_VULKAN_1_2}) {
    const auto consumer = nullptr;
    const auto context =
        BuildModule(env, consumer, shader, kFuzzAssembleOption);
    spvtools::ValidatorOptions validator_options;
    ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(
        context.get(), validator_options, kConsoleMessageConsumer));
    TransformationContext transformation_context(
        MakeUnique<FactManager>(context.get()), validator_options);
    {
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 0),
          (uint32_t)spv::MemoryAccessMask::Aligned |
              (uint32_t)spv::MemoryAccessMask::Volatile,
          1);
      // Bad: cannot remove aligned
      ASSERT_FALSE(TransformationSetMemoryOperandsMask(
                       MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 0),
                       (uint32_t)spv::MemoryAccessMask::Volatile, 1)
                       .IsApplicable(context.get(), transformation_context));
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    {
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 1),
          (uint32_t)spv::MemoryAccessMask::Nontemporal |
              (uint32_t)spv::MemoryAccessMask::Volatile,
          1);
      // Bad: cannot remove volatile
      ASSERT_FALSE(TransformationSetMemoryOperandsMask(
                       MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 1),
                       (uint32_t)spv::MemoryAccessMask::Nontemporal, 0)
                       .IsApplicable(context.get(), transformation_context));
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    {
      // Creates the first operand.
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 2),
          (uint32_t)spv::MemoryAccessMask::Nontemporal |
              (uint32_t)spv::MemoryAccessMask::Volatile,
          0);
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    {
      // Creates both operands.
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(21, spv::Op::OpCopyMemory, 3),
          (uint32_t)spv::MemoryAccessMask::Nontemporal |
              (uint32_t)spv::MemoryAccessMask::Volatile,
          1);
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    {
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(138, spv::Op::OpCopyMemory, 0),
          (uint32_t)spv::MemoryAccessMask::Aligned |
              (uint32_t)spv::MemoryAccessMask::Nontemporal,
          1);
      // Bad: the first mask is None, so Aligned cannot be added to it.
      ASSERT_FALSE(TransformationSetMemoryOperandsMask(
                       MakeInstructionDescriptor(138, spv::Op::OpCopyMemory, 0),
                       (uint32_t)spv::MemoryAccessMask::Aligned |
                           (uint32_t)spv::MemoryAccessMask::Nontemporal,
                       0)
                       .IsApplicable(context.get(), transformation_context));
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    {
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(138, spv::Op::OpCopyMemory, 1),
          (uint32_t)spv::MemoryAccessMask::Volatile, 1);
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    {
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(147, spv::Op::OpLoad, 0),
          (uint32_t)spv::MemoryAccessMask::Volatile |
              (uint32_t)spv::MemoryAccessMask::Aligned,
          0);
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    {
      TransformationSetMemoryOperandsMask transformation(
          MakeInstructionDescriptor(148, spv::Op::OpStore, 0),
          (uint32_t)spv::MemoryAccessMask::MaskNone, 0);
      ASSERT_TRUE(
          transformation.IsApplicable(context.get(), transformation_context));
      ApplyAndCheckFreshIds(transformation, context.get(),
                            &transformation_context);
    }

    std::string after_transformation = R"(
                 OpCapability Shader
            %1 = OpExtInstImport "GLSL.std.450"
                 OpMemoryModel Logical GLSL450
                 OpEntryPoint Fragment %4 "main" %12 %17
                 OpExecutionMode %4 OriginUpperLeft
                 OpSource ESSL 310
                 OpName %4 "main"
                 OpName %7 "Point3D"
                 OpMemberName %7 0 "x"
                 OpMemberName %7 1 "y"
                 OpMemberName %7 2 "z"
                 OpName %12 "global_points"
                 OpName %15 "block"
                 OpMemberName %15 0 "in_points"
                 OpMemberName %15 1 "in_point"
                 OpName %17 ""
                 OpName %133 "local_points"
                 OpMemberDecorate %7 0 Offset 0
                 OpMemberDecorate %7 1 Offset 4
                 OpMemberDecorate %7 2 Offset 8
                 OpDecorate %10 ArrayStride 16
                 OpMemberDecorate %15 0 Offset 0
                 OpMemberDecorate %15 1 Offset 192
                 OpDecorate %15 Block
                 OpDecorate %17 DescriptorSet 0
                 OpDecorate %17 Binding 0
            %2 = OpTypeVoid
            %3 = OpTypeFunction %2
            %6 = OpTypeFloat 32
            %7 = OpTypeStruct %6 %6 %6
            %8 = OpTypeInt 32 0
            %9 = OpConstant %8 12
           %10 = OpTypeArray %7 %9
           %11 = OpTypePointer Private %10
           %12 = OpVariable %11 Private
           %15 = OpTypeStruct %10 %7
           %16 = OpTypePointer Uniform %15
           %17 = OpVariable %16 Uniform
           %18 = OpTypeInt 32 1
           %19 = OpConstant %18 0
           %20 = OpTypePointer Uniform %10
           %24 = OpTypePointer Private %7
           %27 = OpTypePointer Private %6
           %30 = OpConstant %18 1
          %132 = OpTypePointer Function %10
          %135 = OpTypePointer Uniform %7
          %145 = OpTypePointer Function %7
            %4 = OpFunction %2 None %3
            %5 = OpLabel
          %133 = OpVariable %132 Function
           %21 = OpAccessChain %20 %17 %19
                 OpCopyMemory %12 %21 Aligned 16 Aligned|Volatile 16
                 OpCopyMemory %133 %12 Volatile Nontemporal|Volatile
                 OpCopyMemory %133 %12 Nontemporal|Volatile
                 OpCopyMemory %133 %12 None Nontemporal|Volatile
          %136 = OpAccessChain %135 %17 %30
          %138 = OpAccessChain %24 %12 %19
                 OpCopyMemory %138 %136 None Aligned|Nontemporal 16
                 OpCopyMemory %138 %136 Aligned 16 Volatile
          %146 = OpAccessChain %145 %133 %30
          %147 = OpLoad %7 %146 Volatile|Aligned 16
          %148 = OpAccessChain %24 %12 %19
                 OpStore %148 %147 None
                 OpReturn
                 OpFunctionEnd
    )";
    ASSERT_TRUE(IsEqual(env, after_transformation, context.get()));
  }
}

}  // namespace
}  // namespace fuzz
}  // namespace spvtools