<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>199424</bug_id>
          
          <creation_ts>2019-07-02 15:29:03 -0700</creation_ts>
          <short_desc>[WHLSL] Change whlsl-two-dimensional-array.html to not be flaky on AMD Radeon Pro GPUs</short_desc>
          <delta_ts>2019-07-02 16:54:15 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebGPU</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Saam Barati">saam</reporter>
          <assigned_to name="Saam Barati">saam</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>dino</cc>
    
    <cc>fpizlo</cc>
    
    <cc>jonlee</cc>
    
    <cc>justin_fan</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>rmorisset</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1549739</commentid>
    <comment_count>0</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2019-07-02 15:29:03 -0700</bug_when>
    <thetext>...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1549740</commentid>
    <comment_count>1</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2019-07-02 15:29:50 -0700</bug_when>
    <thetext>See &lt;rdar://problem/52545976&gt; 

The metal reduction is:
```
#include &lt;metal_stdlib&gt;
#include &lt;metal_atomic&gt;
#include &lt;metal_math&gt;
#include &lt;metal_relational&gt;
#include &lt;metal_compute&gt;
#include &lt;metal_texture&gt;

using namespace metal;

typedef array&lt;float, 10&gt; BaseArray;
typedef array&lt;BaseArray, 5&gt; ParentArray;

struct WrapperStruct {
    ParentArray parentArray;
    uint outerIndex;
    BaseArray baseArray;
    uint index;
};

struct InputStruct {
    device int32_t* ptr [[id(0)]];
    uint2 structureElement20 [[id(1)]];
};


kernel void computeShader(device int32_t* ptr) {
    WrapperStruct wrapperStruct = { 0 };
    wrapperStruct.parentArray = { 0 };
    wrapperStruct.outerIndex = 0;

    for (; wrapperStruct.outerIndex &lt; wrapperStruct.parentArray.size(); ++wrapperStruct.outerIndex) {
        wrapperStruct.baseArray = { 0 };
        for (unsigned j = 0; j &lt; wrapperStruct.baseArray.size(); ++j) {
            wrapperStruct.baseArray[j] = wrapperStruct.outerIndex;
        }
        wrapperStruct.parentArray[wrapperStruct.outerIndex] = wrapperStruct.baseArray;
    }


    wrapperStruct.outerIndex = 0;
    for (; wrapperStruct.outerIndex &lt; wrapperStruct.parentArray.size(); wrapperStruct.outerIndex++) {
        wrapperStruct.baseArray = wrapperStruct.parentArray[wrapperStruct.outerIndex];
        wrapperStruct.index = 0;
        for ( ; wrapperStruct.index &lt; wrapperStruct.baseArray.size(); wrapperStruct.index += 1) {
            if (wrapperStruct.baseArray[wrapperStruct.index] != wrapperStruct.outerIndex) {
                *ptr = 42;
                return;
            }
        }
    }
    *ptr = 1;
}
```

*ptr should be 1, but is 42.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1549752</commentid>
    <comment_count>2</comment_count>
      <attachid>373366</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2019-07-02 15:43:28 -0700</bug_when>
    <thetext>Created attachment 373366
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1549766</commentid>
    <comment_count>3</comment_count>
      <attachid>373366</attachid>
    <who name="Myles C. Maxfield">mmaxfield</who>
    <bug_when>2019-07-02 16:13:58 -0700</bug_when>
    <thetext>Comment on attachment 373366
patch

🤮</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1549784</commentid>
    <comment_count>4</comment_count>
      <attachid>373366</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2019-07-02 16:53:23 -0700</bug_when>
    <thetext>Comment on attachment 373366
patch

Clearing flags on attachment: 373366

Committed r247081: &lt;https://trac.webkit.org/changeset/247081&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1549785</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2019-07-02 16:53:24 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1549786</commentid>
    <comment_count>6</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-07-02 16:54:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/52556060&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>373366</attachid>
            <date>2019-07-02 15:43:28 -0700</date>
            <delta_ts>2019-07-02 16:53:23 -0700</delta_ts>
            <desc>patch</desc>
            <filename>a-backup.diff</filename>
            <type>text/plain</type>
            <size>2464</size>
            <attacher name="Saam Barati">saam</attacher>
            
              <data encoding="base64">SW5kZXg6IExheW91dFRlc3RzL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBMYXlvdXRUZXN0cy9D
aGFuZ2VMb2cJKHJldmlzaW9uIDI0NzA3MykKKysrIExheW91dFRlc3RzL0NoYW5nZUxvZwkod29y
a2luZyBjb3B5KQpAQCAtMSwzICsxLDEyI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HsKKyAgICBmb3IgKHVpbnQgaSA9IDA7IGkgPCBhcnJheS5sZW5ndGg7IGkg
PSBpICsgMSkgewogICAgICAgICBpZiAoYXJyYXlbaV0gIT0gdmFsdWUpCiAgICAgICAgICAgICBy
ZXR1cm4gZmFsc2U7CiAgICAgfQpAQCAtNDUsMTMgKzQ1LDEzIEBAIGNvbXB1dGUgdm9pZCBjb21w
dXRlU2hhZGVyKGRldmljZSBpbnRbXSAKICAgICBpZiAoIWNvbnRhaW5zKEBhcnJheSwgMCkpCiAg
ICAgICAgIHJldHVybjsKIAotICAgIGZvciAodWludCBpID0gMDsgaSA8IGFycmF5Lmxlbmd0aDsg
KytpKSB7CisgICAgZm9yICh1aW50IGkgPSAwOyBpIDwgYXJyYXkubGVuZ3RoOyBpID0gaSArIDEp
IHsKICAgICAgICAgZmxvYXRbMTBdIHZhbHVlOwogICAgICAgICBmaWxsKEB2YWx1ZSwgZmxvYXQo
aSkpOwogICAgICAgICBhcnJheVtpXSA9IHZhbHVlOwogICAgIH0KIAotICAgIGZvciAodWludCBp
ID0gMDsgaSA8IGFycmF5Lmxlbmd0aDsgKytpKSB7CisgICAgZm9yICh1aW50IGkgPSAwOyBpIDwg
YXJyYXkubGVuZ3RoOyBpID0gaSArIDEpIHsKICAgICAgICAgZmxvYXRbMTBdIHZhbHVlID0gYXJy
YXlbaV07CiAgICAgICAgIGlmICghY29udGFpbnMoQHZhbHVlLCBmbG9hdChpKSkpCiAgICAgICAg
ICAgICByZXR1cm47Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>