是否可以将汇编指令放入CUDA代码? [英] Is it possible to put assembly instructions into CUDA code?

查看:468
本文介绍了是否可以将汇编指令放入CUDA代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在CUDA C代码
中使用汇编代码,以减少昂贵的执行
,因为我们在c编程中使用 asm

I want to use assembly code in CUDA C code in order to reduce expensive executions as we do using asm in c programming.

有可能吗?

推荐答案

不,你不能,没有什么像C / C ++的asm结构。您可以做的是调整生成的PTX程序集,然后与CUDA一起使用。

No, you can't, there is nothing like the asm constructs from C/C++. What you can do is tweak the generated PTX assembly and then use it with CUDA.

请参阅这个例子。

See this for an example.

但是对于GPU来说,程序集优化是不必要的,你应该首先做其他优化,例如存储器合并和占用。请参见 CUDA最佳做法指南有关更多信息。

But for GPUs, assembly optimizations are NOT necessary, you should do other optimizations first, such as memory coalescency and occupancy. See the CUDA Best Practices guide for more information.

这篇关于是否可以将汇编指令放入CUDA代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆