Example #1
0
 def kernel(A):
     with hcl.Stage():
         with hcl.for_(0, 10) as i:
             with hcl.for_(0, 10) as j:
                 with hcl.if_(j >= i):
                     hcl.break_()
                 A[i] += j
Example #2
0
 def kernel(A):
     i = hcl.scalar(0)
     with hcl.while_(True):
         with hcl.if_(i[0] > 5):
             hcl.break_()
         A[i[0]] = i[0]
         i[0] += 1
Example #3
0
 def freduce(x, Y):
     with hcl.for_(0, Y.shape[0]) as i:
         with hcl.if_(x < Y[i]):
             with hcl.for_(Y.shape[0]-1, i, -1) as j:
                 Y[j] = Y[j-1]
             Y[i] = x
             hcl.break_()
Example #4
0
 def freduce(x, Y):
     with hcl.for_(0, 10) as i:
         with hcl.if_(x < Y[i]):
             with hcl.for_(9, i, -1) as j:
                 Y[j] = Y[j-1]
             Y[i] = x
             hcl.break_()
Example #5
0
 def kernel(A):
     with hcl.Stage():
         i = hcl.local(0)
         with hcl.while_(True):
             with hcl.if_(i[0] > 5):
                 hcl.break_()
             A[i[0]] = i[0]
             i[0] += 1
Example #6
0
 def kernel(A):
     with hcl.Stage():
         with hcl.for_(0, 10) as i:
             with hcl.if_(i > 5):
                 hcl.break_()
             A[i] = i