Array bounds checking


#1

Hi. I’d like to discuss the methods of array bounds checking. Consider the following program:

def demo_array_bounds():
  a = tvm.placeholder((10,), name='a')
  b = tvm.compute((10,), lambda i: a[i+100050000])
  # Lets say run_tvm helper schedules, builds, and executes the program
  b_np = run_tvm({ a:np.ones(get_shape(a)).astype(np.float32) },b)
  print(b_np)

Depending on the offset, the result may be a garbage or a segfault. What possibilities does TVM offer to protect the runtime from accessing invalid memory?
What protection methods do you think would be the best to have?