# When to use the constant memory?

**URL:** <https://forums.developer.nvidia.com/t/when-to-use-the-constant-memory/9265>\
**Category:** CUDA Programming and Performance\
**Created:** [May 4, 2009, 1:48pm UTC](https://forums.developer.nvidia.com/t/when-to-use-the-constant-memory/9265 "2009-05-04T13:48:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jesusgumbau](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/jesusgumbau/32/249943_2.png) [@jesusgumbau](https://forums.developer.nvidia.com/u/jesusgumbau)\
**Post date:** [May 4, 2009, 1:48pm UTC](https://forums.developer.nvidia.com/t/when-to-use-the-constant-memory/9265/1 "2009-05-04T13:48:23Z")

</div>

I was told to use texture memory whenever it’s possible to speedup my fetches by using the data cache. However, cosntant memory accesses are also cached. So my question is: how do I decide to use one type or another (texture or constant memory)?

Greetings.

---

<div class="post-metadata">

**Author:** ![AndreiB](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/andreib/32/9727_2.png) [@AndreiB](https://forums.developer.nvidia.com/u/AndreiB)\
**Post date:** [May 4, 2009, 2:08pm UTC](https://forums.developer.nvidia.com/t/when-to-use-the-constant-memory/9265/2 "2009-05-04T14:08:11Z")

</div>

If each thread within warp reads same memory location (or maybe two different locations per warp) then use constant memory. Otherwise it’s better to experiment a bit, but texture cache is likely to be faster.
