Skip to content

Commit 8172d40

Browse files
authored
Merge pull request #316 from accel-sim/dev
Support for CUDA 12.x and Ubuntu 24
2 parents 68e1cd3 + 6658752 commit 8172d40

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

libcuda/cuda_runtime_api.cc

+6
Original file line numberDiff line numberDiff line change
@@ -1942,6 +1942,7 @@ __host__ cudaError_t CUDARTAPI cudaBindTextureInternal(
19421942
size_t *offset, const struct textureReference *texref, const void *devPtr,
19431943
const struct cudaChannelFormatDesc *desc, size_t size __dv(UINT_MAX),
19441944
gpgpu_context *gpgpu_ctx = NULL) {
1945+
#if (CUDART_VERSION <= 1200)
19451946
gpgpu_context *ctx;
19461947
if (gpgpu_ctx) {
19471948
ctx = gpgpu_ctx;
@@ -1978,12 +1979,14 @@ __host__ cudaError_t CUDARTAPI cudaBindTextureInternal(
19781979
gpu->gpgpu_ptx_sim_bindTextureToArray(texref, array);
19791980
devPtr = (void *)(long long)array->devPtr32;
19801981
printf("GPGPU-Sim PTX: devPtr = %p\n", devPtr);
1982+
#endif
19811983
return g_last_cudaError = cudaSuccess;
19821984
}
19831985

19841986
__host__ cudaError_t CUDARTAPI cudaBindTextureToArrayInternal(
19851987
const struct textureReference *texref, const struct cudaArray *array,
19861988
const struct cudaChannelFormatDesc *desc, gpgpu_context *gpgpu_ctx = NULL) {
1989+
#if (CUDART_VERSION <= 1200)
19871990
gpgpu_context *ctx;
19881991
if (gpgpu_ctx) {
19891992
ctx = gpgpu_ctx;
@@ -2001,11 +2004,13 @@ __host__ cudaError_t CUDARTAPI cudaBindTextureToArrayInternal(
20012004
gpu->gpgpu_ptx_sim_findNamefromTexture(texref));
20022005
printf("GPGPU-Sim PTX: Texture Normalized? = %d\n", texref->normalized);
20032006
gpu->gpgpu_ptx_sim_bindTextureToArray(texref, array);
2007+
#endif
20042008
return g_last_cudaError = cudaSuccess;
20052009
}
20062010

20072011
__host__ cudaError_t CUDARTAPI cudaUnbindTextureInternal(
20082012
const struct textureReference *texref, gpgpu_context *gpgpu_ctx = NULL) {
2013+
#if (CUDART_VERSION <= 1200)
20092014
gpgpu_context *ctx;
20102015
if (gpgpu_ctx) {
20112016
ctx = gpgpu_ctx;
@@ -2025,6 +2030,7 @@ __host__ cudaError_t CUDARTAPI cudaUnbindTextureInternal(
20252030
gpu->gpgpu_ptx_sim_findNamefromTexture(texref));
20262031

20272032
gpu->gpgpu_ptx_sim_unbindTexture(texref);
2033+
#endif
20282034
return g_last_cudaError = cudaSuccess;
20292035
}
20302036

src/cuda-sim/cuda-sim.cc

+6
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ cudaLaunchDeviceV2_init_perWarp, cudaLaunchDevicV2_perKernel>"
125125
void gpgpu_t::gpgpu_ptx_sim_bindNameToTexture(
126126
const char *name, const struct textureReference *texref, int dim,
127127
int readmode, int ext) {
128+
#if (CUDART_VERSION <= 1200)
128129
std::string texname(name);
129130
if (m_NameToTextureRef.find(texname) == m_NameToTextureRef.end()) {
130131
m_NameToTextureRef[texname] = std::set<const struct textureReference *>();
@@ -148,6 +149,7 @@ void gpgpu_t::gpgpu_ptx_sim_bindNameToTexture(
148149
const textureReferenceAttr *texAttr = new textureReferenceAttr(
149150
texref, dim, (enum cudaTextureReadMode)readmode, ext);
150151
m_NameToAttribute[texname] = texAttr;
152+
#endif
151153
}
152154

153155
const char *gpgpu_t::gpgpu_ptx_sim_findNamefromTexture(
@@ -185,6 +187,7 @@ unsigned int intLOGB2(unsigned int v) {
185187

186188
void gpgpu_t::gpgpu_ptx_sim_bindTextureToArray(
187189
const struct textureReference *texref, const struct cudaArray *array) {
190+
#if (CUDART_VERSION <= 1200)
188191
std::string texname = gpgpu_ptx_sim_findNamefromTexture(texref);
189192

190193
std::map<std::string, const struct cudaArray *>::const_iterator t =
@@ -258,14 +261,17 @@ void gpgpu_t::gpgpu_ptx_sim_bindTextureToArray(
258261
texInfo->texel_size = texel_size;
259262
texInfo->texel_size_numbits = intLOGB2(texel_size);
260263
m_NameToTextureInfo[texname] = texInfo;
264+
#endif
261265
}
262266

263267
void gpgpu_t::gpgpu_ptx_sim_unbindTexture(
264268
const struct textureReference *texref) {
269+
#if (CUDART_VERSION <= 1200)
265270
// assumes bind-use-unbind-bind-use-unbind pattern
266271
std::string texname = gpgpu_ptx_sim_findNamefromTexture(texref);
267272
m_NameToCudaArray.erase(texname);
268273
m_NameToTextureInfo.erase(texname);
274+
#endif
269275
}
270276

271277
#define MAX_INST_SIZE 8 /*bytes*/

src/cuda-sim/instructions.cc

+2
Original file line numberDiff line numberDiff line change
@@ -6046,6 +6046,7 @@ void textureNormalizeOutput(const struct cudaChannelFormatDesc &desc,
60466046
}
60476047

60486048
void tex_impl(const ptx_instruction *pI, ptx_thread_info *thread) {
6049+
#if (CUDART_VERSION <= 1200)
60496050
unsigned dimension = pI->dimension();
60506051
const operand_info &dst =
60516052
pI->dst(); // the registers to which fetched texel will be placed
@@ -6373,6 +6374,7 @@ void tex_impl(const ptx_instruction *pI, ptx_thread_info *thread) {
63736374
}
63746375

63756376
thread->set_vector_operand_values(dst, data1, data2, data3, data4);
6377+
#endif
63766378
}
63776379

63786380
void txq_impl(const ptx_instruction *pI, ptx_thread_info *thread) {

src/gpgpu-sim/gpu-sim.h

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <fstream>
3737
#include <iostream>
3838
#include <list>
39+
#include <stdint.h>
3940
#include "../abstract_hardware_model.h"
4041
#include "../option_parser.h"
4142
#include "../trace.h"

0 commit comments

Comments
 (0)