Created
January 23, 2015 16:13
-
-
Save navyxliu/b72419edbea4e349cd54 to your computer and use it in GitHub Desktop.
bug018
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <amp.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <vector> | |
using namespace Concurrency; | |
template <typename _type> | |
int test_debug() __GPU { | |
const int rank = _type::rank; | |
int data1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; | |
int correct_size = 1; | |
extent<rank> e1(data1); | |
const _type g1(e1); | |
//bad | |
for (int i = 0; i < 2; i++) | |
correct_size = data1[i]; | |
//okay | |
// correct_size = data1[1]; | |
return correct_size; | |
} | |
int main() | |
{ | |
int gpu_result; | |
concurrency::array_view<int, 1> gpu_resultv(1, &gpu_result); | |
gpu_resultv.discard_data(); | |
concurrency::parallel_for_each(gpu_resultv.get_extent() | |
, [=](concurrency::index<1> idx) restrict(amp) { | |
gpu_resultv[idx] = []() restrict(amp,cpu)->int{ | |
return test_debug<extent<4>>(); | |
}(); | |
}); | |
gpu_resultv.synchronize(); | |
printf("%d", gpu_result); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I spot the same issue using both pathscale's branch and llvm svn trunk. I am targeting to southern island processors.
the problem instruction is buffer_load_dword in BB#2. you can reproduce it using 'llc -march=r600 -mcpu=tahiti --filetype=asm bug018.ll -o bug018.s'. the sbase s[8:11] is wrong because s[8:9] is assigned as 0. it should point to the scratch. the values of data1 are on it.