<commit_before>-- Copyright 2016 Stanford University
--
-- 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.

-- runs-with:
-- [
--   ["-ll:cpu", "4", "-fflow-spmd", "1"],
--   ["-ll:cpu", "2", "-fflow-spmd", "1", "-fflow-spmd-shardsize", "2"]
-- ]

import "regent"

-- This tests the SPMD optimization of the compiler with:
--   * keeping multiple partitions up-to-date

fspace st {
  x : int,
  y : int,
}

task a(r : region(st))
where reads writes(r.x), reads(r.y) do
  for e in r do
    e.x = e.y + 1
  end
end

task b(r : region(st), s : region(st), t : region(st), u : region(st))
where reads(r.x, s.x, t.x, u.x), writes(r.y) do
  for e in r do
    r[e].y = 2*r[e].x + 3*s[e].x + 4*t[e].x + 5*u[e].x
  end
end

task main()
  var cs = ispace(int1d, 3)
  var r = region(ispace(ptr, 5), st)
  var e0 = new(ptr(st, r))
  var e1 = new(ptr(st, r))
  var e2 = new(ptr(st, r))
  var e3 = new(ptr(st, r))
  var e4 = new(ptr(st, r))

  -- These have to be separate partitions to trigger the bug.
  var m = partition(equal, r, cs)
  var n = partition(equal, r, cs)
  var o = partition(equal, r, cs)
  var p = partition(equal, r, cs)

  for e in r do
    e.x = 0
    e.y = int(e)
  end<commit_msg>regent: Avoid triggering vectorizer bug.<commit_after>-- Copyright 2016 Stanford University
--
-- 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.

-- runs-with:
-- [
--   ["-ll:cpu", "4", "-fflow-spmd", "1"],
--   ["-ll:cpu", "2", "-fflow-spmd", "1", "-fflow-spmd-shardsize", "2"]
-- ]

import "regent"

-- This tests the SPMD optimization of the compiler with:
--   * keeping multiple partitions up-to-date

fspace st {
  x : int,
  y : int,
}

task a(r : region(st))
where reads writes(r.x), reads(r.y) do
  for e in r do
    e.x = e.y + 1
  end
end

task b(r : region(st), s : region(st), t : region(st), u : region(st))
where reads(r.x, s.x, t.x, u.x), writes(r.y) do
  for e in r do
    r[e].y = 2*r[e].x + 3*s[e].x + 4*t[e].x + 5*u[e].x
  end
end

task main()
  var cs = ispace(int1d, 3)
  var r = region(ispace(ptr, 5), st)
  var e0 = new(ptr(st, r))
  var e1 = new(ptr(st, r))
  var e2 = new(ptr(st, r))
  var e3 = new(ptr(st, r))
  var e4 = new(ptr(st, r))

  -- These have to be separate partitions to trigger the bug.
  var m = partition(equal, r, cs)
  var n = partition(equal, r, cs)
  var o = partition(equal, r, cs)
  var p = partition(equal, r, cs)

  -- FIXME: This triggers a vectorizer bug.
  __forbid(__vectorize)
  for e in r do
    e.x = 0
    e.y = int(e)
  end
{'fraction_non_alphanumeric': 0.15627693191611605, 'fraction_numerical': 0.015512783682849756, 'mean_word_length': 2.8645948945615984, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '981689', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1275, 'n_words': 474}