首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用DPC++图像数组时的尺寸和读取问题

使用DPC++图像数组时的尺寸和读取问题
EN

Stack Overflow用户
提问于 2021-08-11 02:15:46
回答 1查看 45关注 0票数 0

这个问题真的把我搞糊涂了。我想使用DPC++来读取一组图像,所以使用了sycl::图像,下面是我的代码。

代码语言:javascript
复制
#define N 4   //dimensin
#define M 128 //dimension 
#define C 4   //4 channel
#define L 2   // 2 images
int * host_array3_2 = malloc_host<int>(N*M*C*L, Q);
image im3(host_array3_2, image_channel_order::rgba, image_channel_type::unsigned_int32, range{ M,N,L}); //the image format

内核代码如下,我使用带有image_array标签的访问器来读取数据:

代码语言:javascript
复制
Q.submit([&](handler &h) {
           auto out = sycl::stream(1024, 1024 * 2, h);
            accessor<int4, 2, access::mode::read, access::target::image_array> acs3(im3, h);//the accessor format
            h.parallel_for(nd_range{ range{ M ,N,L }, range{ N,N,L } }, [=](nd_item<3> it) {
            int idx = it.get_global_linear_id();
                if (idx == 0){
            confuse here:  out << acs3.get_count() << " " << acs3.get_range() << " \n";
                //const auto &ss = acs3[0];    no compile error
        confuse here:  //ss.read(int2(0, 1));         compiler error: "array subscript out of range"  "SYCL kernel cannot call a variadic function"}
            });
        });

除了读取问题,我发现范围是{128,4,4},为什么第三个维度是4?不是L(2)的值吗?

而且似乎第三维只依赖于第二维,无论L是什么。有人能回答我吗?

EN

回答 1

Stack Overflow用户

发布于 2021-08-11 04:44:57

一个有趣的现象,在发布编译模式下是可以的,而且输出也是不一样的。这太奇怪了

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68735270

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档