add and update samples for CUDA 11.6

This commit is contained in:
Rutwik Choughule
2022-01-13 11:35:24 +05:30
parent 11de19f00c
commit 2e41896e1b
4615 changed files with 178150 additions and 181350 deletions

View File

@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/../../../Common"
],
"defines": [],
"compilerPath": "/usr/local/cuda/bin/nvcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.makefile-tools"
}
],
"version": 4
}

View File

@@ -0,0 +1,7 @@
{
"recommendations": [
"nvidia.nsight-vscode-edition",
"ms-vscode.cpptools",
"ms-vscode.makefile-tools"
]
}

View File

@@ -0,0 +1,10 @@
{
"configurations": [
{
"name": "CUDA C++: Launch",
"type": "cuda-gdb",
"request": "launch",
"program": "${workspaceFolder}/matrixMulDynlinkJIT"
}
]
}

View File

@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -0,0 +1,340 @@
################################################################################
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
################################################################################
#
# Makefile project only supported on Mac OS X and Linux Platforms)
#
################################################################################
# Location of the CUDA Toolkit
CUDA_PATH ?= /usr/local/cuda
##############################
# start deprecated interface #
##############################
ifeq ($(x86_64),1)
$(info WARNING - x86_64 variable has been deprecated)
$(info WARNING - please use TARGET_ARCH=x86_64 instead)
TARGET_ARCH ?= x86_64
endif
ifeq ($(ARMv7),1)
$(info WARNING - ARMv7 variable has been deprecated)
$(info WARNING - please use TARGET_ARCH=armv7l instead)
TARGET_ARCH ?= armv7l
endif
ifeq ($(aarch64),1)
$(info WARNING - aarch64 variable has been deprecated)
$(info WARNING - please use TARGET_ARCH=aarch64 instead)
TARGET_ARCH ?= aarch64
endif
ifeq ($(ppc64le),1)
$(info WARNING - ppc64le variable has been deprecated)
$(info WARNING - please use TARGET_ARCH=ppc64le instead)
TARGET_ARCH ?= ppc64le
endif
ifneq ($(GCC),)
$(info WARNING - GCC variable has been deprecated)
$(info WARNING - please use HOST_COMPILER=$(GCC) instead)
HOST_COMPILER ?= $(GCC)
endif
ifneq ($(abi),)
$(error ERROR - abi variable has been removed)
endif
############################
# end deprecated interface #
############################
# architecture
HOST_ARCH := $(shell uname -m)
TARGET_ARCH ?= $(HOST_ARCH)
ifneq (,$(filter $(TARGET_ARCH),x86_64 aarch64 sbsa ppc64le armv7l))
ifneq ($(TARGET_ARCH),$(HOST_ARCH))
ifneq (,$(filter $(TARGET_ARCH),x86_64 aarch64 sbsa ppc64le))
TARGET_SIZE := 64
else ifneq (,$(filter $(TARGET_ARCH),armv7l))
TARGET_SIZE := 32
endif
else
TARGET_SIZE := $(shell getconf LONG_BIT)
endif
else
$(error ERROR - unsupported value $(TARGET_ARCH) for TARGET_ARCH!)
endif
# sbsa and aarch64 systems look similar. Need to differentiate them at host level for now.
ifeq ($(HOST_ARCH),aarch64)
ifeq ($(CUDA_PATH)/targets/sbsa-linux,$(shell ls -1d $(CUDA_PATH)/targets/sbsa-linux 2>/dev/null))
HOST_ARCH := sbsa
TARGET_ARCH := sbsa
endif
endif
ifneq ($(TARGET_ARCH),$(HOST_ARCH))
ifeq (,$(filter $(HOST_ARCH)-$(TARGET_ARCH),aarch64-armv7l x86_64-armv7l x86_64-aarch64 x86_64-sbsa x86_64-ppc64le))
$(error ERROR - cross compiling from $(HOST_ARCH) to $(TARGET_ARCH) is not supported!)
endif
endif
# When on native aarch64 system with userspace of 32-bit, change TARGET_ARCH to armv7l
ifeq ($(HOST_ARCH)-$(TARGET_ARCH)-$(TARGET_SIZE),aarch64-aarch64-32)
TARGET_ARCH = armv7l
endif
# operating system
HOST_OS := $(shell uname -s 2>/dev/null | tr "[:upper:]" "[:lower:]")
TARGET_OS ?= $(HOST_OS)
ifeq (,$(filter $(TARGET_OS),linux darwin qnx android))
$(error ERROR - unsupported value $(TARGET_OS) for TARGET_OS!)
endif
# host compiler
ifeq ($(TARGET_OS),darwin)
ifeq ($(shell expr `xcodebuild -version | grep -i xcode | awk '{print $$2}' | cut -d'.' -f1` \>= 5),1)
HOST_COMPILER ?= clang++
endif
else ifneq ($(TARGET_ARCH),$(HOST_ARCH))
ifeq ($(HOST_ARCH)-$(TARGET_ARCH),x86_64-armv7l)
ifeq ($(TARGET_OS),linux)
HOST_COMPILER ?= arm-linux-gnueabihf-g++
else ifeq ($(TARGET_OS),qnx)
ifeq ($(QNX_HOST),)
$(error ERROR - QNX_HOST must be passed to the QNX host toolchain)
endif
ifeq ($(QNX_TARGET),)
$(error ERROR - QNX_TARGET must be passed to the QNX target toolchain)
endif
export QNX_HOST
export QNX_TARGET
HOST_COMPILER ?= $(QNX_HOST)/usr/bin/arm-unknown-nto-qnx6.6.0eabi-g++
else ifeq ($(TARGET_OS),android)
HOST_COMPILER ?= arm-linux-androideabi-g++
endif
else ifeq ($(TARGET_ARCH),aarch64)
ifeq ($(TARGET_OS), linux)
HOST_COMPILER ?= aarch64-linux-gnu-g++
else ifeq ($(TARGET_OS),qnx)
ifeq ($(QNX_HOST),)
$(error ERROR - QNX_HOST must be passed to the QNX host toolchain)
endif
ifeq ($(QNX_TARGET),)
$(error ERROR - QNX_TARGET must be passed to the QNX target toolchain)
endif
export QNX_HOST
export QNX_TARGET
HOST_COMPILER ?= $(QNX_HOST)/usr/bin/q++
else ifeq ($(TARGET_OS), android)
HOST_COMPILER ?= aarch64-linux-android-clang++
endif
else ifeq ($(TARGET_ARCH),sbsa)
HOST_COMPILER ?= aarch64-linux-gnu-g++
else ifeq ($(TARGET_ARCH),ppc64le)
HOST_COMPILER ?= powerpc64le-linux-gnu-g++
endif
endif
HOST_COMPILER ?= g++
NVCC := $(CUDA_PATH)/bin/nvcc -ccbin $(HOST_COMPILER)
# internal flags
NVCCFLAGS := -m${TARGET_SIZE}
CCFLAGS :=
LDFLAGS :=
# build flags
ifeq ($(TARGET_OS),darwin)
LDFLAGS += -rpath $(CUDA_PATH)/lib
CCFLAGS += -arch $(HOST_ARCH)
else ifeq ($(HOST_ARCH)-$(TARGET_ARCH)-$(TARGET_OS),x86_64-armv7l-linux)
LDFLAGS += --dynamic-linker=/lib/ld-linux-armhf.so.3
CCFLAGS += -mfloat-abi=hard
else ifeq ($(TARGET_OS),android)
LDFLAGS += -pie
CCFLAGS += -fpie -fpic -fexceptions
endif
ifneq ($(TARGET_ARCH),$(HOST_ARCH))
ifeq ($(TARGET_ARCH)-$(TARGET_OS),armv7l-linux)
ifneq ($(TARGET_FS),)
GCCVERSIONLTEQ46 := $(shell expr `$(HOST_COMPILER) -dumpversion` \<= 4.6)
ifeq ($(GCCVERSIONLTEQ46),1)
CCFLAGS += --sysroot=$(TARGET_FS)
endif
LDFLAGS += --sysroot=$(TARGET_FS)
LDFLAGS += -rpath-link=$(TARGET_FS)/lib
LDFLAGS += -rpath-link=$(TARGET_FS)/usr/lib
LDFLAGS += -rpath-link=$(TARGET_FS)/usr/lib/arm-linux-gnueabihf
endif
endif
ifeq ($(TARGET_ARCH)-$(TARGET_OS),aarch64-linux)
ifneq ($(TARGET_FS),)
GCCVERSIONLTEQ46 := $(shell expr `$(HOST_COMPILER) -dumpversion` \<= 4.6)
ifeq ($(GCCVERSIONLTEQ46),1)
CCFLAGS += --sysroot=$(TARGET_FS)
endif
LDFLAGS += --sysroot=$(TARGET_FS)
LDFLAGS += -rpath-link=$(TARGET_FS)/lib -L$(TARGET_FS)/lib
LDFLAGS += -rpath-link=$(TARGET_FS)/lib/aarch64-linux-gnu -L$(TARGET_FS)/lib/aarch64-linux-gnu
LDFLAGS += -rpath-link=$(TARGET_FS)/usr/lib -L$(TARGET_FS)/usr/lib
LDFLAGS += -rpath-link=$(TARGET_FS)/usr/lib/aarch64-linux-gnu -L$(TARGET_FS)/usr/lib/aarch64-linux-gnu
LDFLAGS += --unresolved-symbols=ignore-in-shared-libs
CCFLAGS += -isystem=$(TARGET_FS)/usr/include -I$(TARGET_FS)/usr/include -I$(TARGET_FS)/usr/include/libdrm
CCFLAGS += -isystem=$(TARGET_FS)/usr/include/aarch64-linux-gnu -I$(TARGET_FS)/usr/include/aarch64-linux-gnu
endif
endif
ifeq ($(TARGET_ARCH)-$(TARGET_OS),aarch64-qnx)
NVCCFLAGS += -D_QNX_SOURCE
NVCCFLAGS += --qpp-config 8.3.0,gcc_ntoaarch64le
CCFLAGS += -DWIN_INTERFACE_CUSTOM -I/usr/include/aarch64-qnx-gnu
LDFLAGS += -lsocket
LDFLAGS += -L/usr/lib/aarch64-qnx-gnu
CCFLAGS += "-Wl\,-rpath-link\,/usr/lib/aarch64-qnx-gnu"
ifdef TARGET_OVERRIDE
LDFLAGS += -lslog2
endif
ifneq ($(TARGET_FS),)
LDFLAGS += -L$(TARGET_FS)/usr/lib
CCFLAGS += "-Wl\,-rpath-link\,$(TARGET_FS)/usr/lib"
LDFLAGS += -L$(TARGET_FS)/usr/libnvidia
CCFLAGS += "-Wl\,-rpath-link\,$(TARGET_FS)/usr/libnvidia"
CCFLAGS += -I$(TARGET_FS)/../include
endif
endif
endif
ifdef TARGET_OVERRIDE # cuda toolkit targets override
NVCCFLAGS += -target-dir $(TARGET_OVERRIDE)
endif
# Install directory of different arch
CUDA_INSTALL_TARGET_DIR :=
ifeq ($(TARGET_ARCH)-$(TARGET_OS),armv7l-linux)
CUDA_INSTALL_TARGET_DIR = targets/armv7-linux-gnueabihf/
else ifeq ($(TARGET_ARCH)-$(TARGET_OS),aarch64-linux)
CUDA_INSTALL_TARGET_DIR = targets/aarch64-linux/
else ifeq ($(TARGET_ARCH)-$(TARGET_OS),sbsa-linux)
CUDA_INSTALL_TARGET_DIR = targets/sbsa-linux/
else ifeq ($(TARGET_ARCH)-$(TARGET_OS),armv7l-android)
CUDA_INSTALL_TARGET_DIR = targets/armv7-linux-androideabi/
else ifeq ($(TARGET_ARCH)-$(TARGET_OS),aarch64-android)
CUDA_INSTALL_TARGET_DIR = targets/aarch64-linux-androideabi/
else ifeq ($(TARGET_ARCH)-$(TARGET_OS),armv7l-qnx)
CUDA_INSTALL_TARGET_DIR = targets/ARMv7-linux-QNX/
else ifeq ($(TARGET_ARCH)-$(TARGET_OS),aarch64-qnx)
CUDA_INSTALL_TARGET_DIR = targets/aarch64-qnx/
else ifeq ($(TARGET_ARCH),ppc64le)
CUDA_INSTALL_TARGET_DIR = targets/ppc64le-linux/
endif
# Debug build flags
ifeq ($(dbg),1)
NVCCFLAGS += -g -G
BUILD_TYPE := debug
else
BUILD_TYPE := release
endif
ALL_CCFLAGS :=
ALL_CCFLAGS += $(NVCCFLAGS)
ALL_CCFLAGS += $(EXTRA_NVCCFLAGS)
ALL_CCFLAGS += $(addprefix -Xcompiler ,$(CCFLAGS))
ALL_CCFLAGS += $(addprefix -Xcompiler ,$(EXTRA_CCFLAGS))
ALL_LDFLAGS :=
ALL_LDFLAGS += $(ALL_CCFLAGS)
ALL_LDFLAGS += $(addprefix -Xlinker ,$(LDFLAGS))
ALL_LDFLAGS += $(addprefix -Xlinker ,$(EXTRA_LDFLAGS))
# Common includes and paths for CUDA
INCLUDES := -I../../../Common
LIBRARIES :=
################################################################################
# Gencode arguments
SMS ?=
ifeq ($(GENCODE_FLAGS),)
# Generate SASS code for each SM architecture listed in $(SMS)
$(foreach sm,$(SMS),$(eval GENCODE_FLAGS += -gencode arch=compute_$(sm),code=sm_$(sm)))
ifeq ($(SMS),)
ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),armv7l aarch64 sbsa))
# Generate PTX code from SM 53
GENCODE_FLAGS += -gencode arch=compute_53,code=compute_53
else
# Generate PTX code from SM 35
GENCODE_FLAGS += -gencode arch=compute_35,code=compute_35
endif
endif
# Generate PTX code from the highest SM architecture in $(SMS) to guarantee forward-compatibility
HIGHEST_SM := $(lastword $(sort $(SMS)))
ifneq ($(HIGHEST_SM),)
GENCODE_FLAGS += -gencode arch=compute_$(HIGHEST_SM),code=compute_$(HIGHEST_SM)
endif
endif
ALL_CCFLAGS += --threads 0 --std=c++11
################################################################################
# Target rules
all: build
build: matrixMulDynlinkJIT
cuda_drvapi_dynlink.c.o:cuda_drvapi_dynlink.c
$(NVCC) $(INCLUDES) $(ALL_CCFLAGS) $(GENCODE_FLAGS) -o $@ -c $<
matrixMulDynlinkJIT.o:matrixMulDynlinkJIT.cpp
$(NVCC) $(INCLUDES) $(ALL_CCFLAGS) $(GENCODE_FLAGS) -o $@ -c $<
matrixMul_gold.o:matrixMul_gold.cpp
$(NVCC) $(INCLUDES) $(ALL_CCFLAGS) $(GENCODE_FLAGS) -o $@ -c $<
matrixMul_kernel_32_ptxdump.c.o:matrixMul_kernel_32_ptxdump.c
$(NVCC) $(INCLUDES) $(ALL_CCFLAGS) $(GENCODE_FLAGS) -o $@ -c $<
matrixMul_kernel_64_ptxdump.c.o:matrixMul_kernel_64_ptxdump.c
$(NVCC) $(INCLUDES) $(ALL_CCFLAGS) $(GENCODE_FLAGS) -o $@ -c $<
matrixMulDynlinkJIT: cuda_drvapi_dynlink.c.o matrixMulDynlinkJIT.o matrixMul_gold.o matrixMul_kernel_32_ptxdump.c.o matrixMul_kernel_64_ptxdump.c.o
$(NVCC) $(ALL_LDFLAGS) $(GENCODE_FLAGS) -o $@ $+ $(LIBRARIES)
mkdir -p ../../../bin/$(TARGET_ARCH)/$(TARGET_OS)/$(BUILD_TYPE)
cp $@ ../../../bin/$(TARGET_ARCH)/$(TARGET_OS)/$(BUILD_TYPE)
run: build
./matrixMulDynlinkJIT
testrun: build
clean:
rm -f matrixMulDynlinkJIT cuda_drvapi_dynlink.c.o matrixMulDynlinkJIT.o matrixMul_gold.o matrixMul_kernel_32_ptxdump.c.o matrixMul_kernel_64_ptxdump.c.o
rm -rf ../../../bin/$(TARGET_ARCH)/$(TARGET_OS)/$(BUILD_TYPE)/matrixMulDynlinkJIT
clobber: clean

View File

@@ -0,0 +1,70 @@
# matrixMulDynlinkJIT - Matrix Multiplication (CUDA Driver API version with Dynamic Linking Version)
## Description
This sample revisits matrix multiplication using the CUDA driver API. It demonstrates how to link to CUDA driver at runtime and how to use JIT (just-in-time) compilation from PTX code. It has been written for clarity of exposition to illustrate various CUDA programming principles, not with the goal of providing the most performant generic kernel for matrix multiplication. CUBLAS provides high-performance matrix multiplication.
## Key Concepts
CUDA Driver API, CUDA Dynamically Linked Library
## Supported SM Architectures
[SM 3.5 ](https://developer.nvidia.com/cuda-gpus) [SM 3.7 ](https://developer.nvidia.com/cuda-gpus) [SM 5.0 ](https://developer.nvidia.com/cuda-gpus) [SM 5.2 ](https://developer.nvidia.com/cuda-gpus) [SM 5.3 ](https://developer.nvidia.com/cuda-gpus) [SM 6.0 ](https://developer.nvidia.com/cuda-gpus) [SM 6.1 ](https://developer.nvidia.com/cuda-gpus) [SM 7.0 ](https://developer.nvidia.com/cuda-gpus) [SM 7.2 ](https://developer.nvidia.com/cuda-gpus) [SM 7.5 ](https://developer.nvidia.com/cuda-gpus) [SM 8.0 ](https://developer.nvidia.com/cuda-gpus) [SM 8.6 ](https://developer.nvidia.com/cuda-gpus) [SM 8.7 ](https://developer.nvidia.com/cuda-gpus)
## Supported OSes
Linux, Windows
## Supported CPU Architecture
x86_64, ppc64le, armv7l
## CUDA APIs involved
### [CUDA Driver API](http://docs.nvidia.com/cuda/cuda-driver-api/index.html)
cuParamSetv, cuMemFree, cuInit, cuModuleGetFunction, cuCtxDestroy, cuCtxCreate, cuDeviceGetName, cuCtxSynchronize, cuParamSeti, cuModuleLoadDataEx, cuDeviceGet, cuFuncSetSharedSize, cuMemAlloc, cuDeviceComputeCapability, cuFuncSetBlockShape, cuMemcpyHtoD, cuParamSetSize, cuLaunchGrid, cuDeviceGetCount, cuLaunchKernel, cuMemcpyDtoH
## Prerequisites
Download and install the [CUDA Toolkit 11.6](https://developer.nvidia.com/cuda-downloads) for your corresponding platform.
## Build and Run
### Windows
The Windows samples are built using the Visual Studio IDE. Solution files (.sln) are provided for each supported version of Visual Studio, using the format:
```
*_vs<version>.sln - for Visual Studio <version>
```
Each individual sample has its own set of solution files in its directory:
To build/examine all the samples at once, the complete solution files should be used. To build/examine a single sample, the individual sample solution files should be used.
> **Note:** Some samples require that the Microsoft DirectX SDK (June 2010 or newer) be installed and that the VC++ directory paths are properly set up (**Tools > Options...**). Check DirectX Dependencies section for details."
### Linux
The Linux samples are built using makefiles. To use the makefiles, change the current directory to the sample directory you wish to build, and run make:
```
$ cd <sample_dir>
$ make
```
The samples makefiles can take advantage of certain options:
* **TARGET_ARCH=<arch>** - cross-compile targeting a specific architecture. Allowed architectures are x86_64, ppc64le, armv7l.
By default, TARGET_ARCH is set to HOST_ARCH. On a x86_64 machine, not setting TARGET_ARCH is the equivalent of setting TARGET_ARCH=x86_64.<br/>
`$ make TARGET_ARCH=x86_64` <br/> `$ make TARGET_ARCH=ppc64le` <br/> `$ make TARGET_ARCH=armv7l` <br/>
See [here](http://docs.nvidia.com/cuda/cuda-samples/index.html#cross-samples) for more details.
* **dbg=1** - build with debug symbols
```
$ make dbg=1
```
* **SMS="A B ..."** - override the SM architectures for which the sample will be built, where `"A B ..."` is a space-delimited list of SM architectures. For example, to generate SASS for SM 50 and SM 60, use `SMS="50 60"`.
```
$ make SMS="50 60"
```
* **HOST_COMPILER=<host_compiler>** - override the default g++ host compiler. See the [Linux Installation Guide](http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements) for a list of supported host compilers.
```
$ make HOST_COMPILER=g++
```
## References (for more details)

View File

@@ -0,0 +1,647 @@
/*
* Copyright 1993-2014 NVIDIA Corporation. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and
* proprietary rights in and to this software and related documentation.
* Any use, reproduction, disclosure, or distribution of this software
* and related documentation without an express license agreement from
* NVIDIA Corporation is strictly prohibited.
*
* Please refer to the applicable NVIDIA end user license agreement (EULA)
* associated with this source code for terms and conditions that govern
* your use of this NVIDIA software.
*
*/
// With these flags defined, this source file will dynamically
// load the corresponding functions. Disabled by default.
//#define CUDA_INIT_D3D9
//#define CUDA_INIT_D3D10
//#define CUDA_INIT_D3D11
//#define CUDA_INIT_OPENGL
#include <stdio.h>
#include "cuda_drvapi_dynlink.h"
tcuInit *_cuInit;
tcuDriverGetVersion *cuDriverGetVersion;
tcuDeviceGet *cuDeviceGet;
tcuDeviceGetCount *cuDeviceGetCount;
tcuDeviceGetName *cuDeviceGetName;
tcuDeviceComputeCapability *cuDeviceComputeCapability;
tcuDeviceTotalMem *cuDeviceTotalMem;
tcuDeviceGetProperties *cuDeviceGetProperties;
tcuDeviceGetAttribute *cuDeviceGetAttribute;
tcuGetErrorString *cuGetErrorString;
tcuCtxCreate *cuCtxCreate;
tcuCtxDestroy *cuCtxDestroy;
tcuCtxAttach *cuCtxAttach;
tcuCtxDetach *cuCtxDetach;
tcuCtxPushCurrent *cuCtxPushCurrent;
tcuCtxPopCurrent *cuCtxPopCurrent;
tcuCtxGetCurrent *cuCtxGetCurrent;
tcuCtxSetCurrent *cuCtxSetCurrent;
tcuCtxGetDevice *cuCtxGetDevice;
tcuCtxSynchronize *cuCtxSynchronize;
tcuModuleLoad *cuModuleLoad;
tcuModuleLoadData *cuModuleLoadData;
tcuModuleLoadDataEx *cuModuleLoadDataEx;
tcuModuleLoadFatBinary *cuModuleLoadFatBinary;
tcuModuleUnload *cuModuleUnload;
tcuModuleGetFunction *cuModuleGetFunction;
tcuModuleGetGlobal *cuModuleGetGlobal;
tcuModuleGetTexRef *cuModuleGetTexRef;
tcuModuleGetSurfRef *cuModuleGetSurfRef;
tcuMemGetInfo *cuMemGetInfo;
tcuMemAlloc *cuMemAlloc;
tcuMemAllocPitch *cuMemAllocPitch;
tcuMemFree *cuMemFree;
tcuMemGetAddressRange *cuMemGetAddressRange;
tcuMemAllocHost *cuMemAllocHost;
tcuMemFreeHost *cuMemFreeHost;
tcuMemHostAlloc *cuMemHostAlloc;
tcuMemHostGetFlags *cuMemHostGetFlags;
tcuMemHostGetDevicePointer *cuMemHostGetDevicePointer;
tcuDeviceGetByPCIBusId *cuDeviceGetByPCIBusId;
tcuDeviceGetPCIBusId *cuDeviceGetPCIBusId;
tcuIpcGetEventHandle *cuIpcGetEventHandle;
tcuIpcOpenEventHandle *cuIpcOpenEventHandle;
tcuIpcGetMemHandle *cuIpcGetMemHandle;
tcuIpcOpenMemHandle *cuIpcOpenMemHandle;
tcuIpcCloseMemHandle *cuIpcCloseMemHandle;
tcuMemHostRegister *cuMemHostRegister;
tcuMemHostUnregister *cuMemHostUnregister;
tcuMemcpyHtoD *cuMemcpyHtoD;
tcuMemcpyDtoH *cuMemcpyDtoH;
tcuMemcpyDtoD *cuMemcpyDtoD;
tcuMemcpyDtoA *cuMemcpyDtoA;
tcuMemcpyAtoD *cuMemcpyAtoD;
tcuMemcpyHtoA *cuMemcpyHtoA;
tcuMemcpyAtoH *cuMemcpyAtoH;
tcuMemcpyAtoA *cuMemcpyAtoA;
tcuMemcpy2D *cuMemcpy2D;
tcuMemcpy2DUnaligned *cuMemcpy2DUnaligned;
tcuMemcpy3D *cuMemcpy3D;
tcuMemcpyHtoDAsync *cuMemcpyHtoDAsync;
tcuMemcpyDtoHAsync *cuMemcpyDtoHAsync;
tcuMemcpyDtoDAsync *cuMemcpyDtoDAsync;
tcuMemcpyHtoAAsync *cuMemcpyHtoAAsync;
tcuMemcpyAtoHAsync *cuMemcpyAtoHAsync;
tcuMemcpy2DAsync *cuMemcpy2DAsync;
tcuMemcpy3DAsync *cuMemcpy3DAsync;
tcuMemcpy *cuMemcpy;
tcuMemcpyPeer *cuMemcpyPeer;
tcuMemsetD8 *cuMemsetD8;
tcuMemsetD16 *cuMemsetD16;
tcuMemsetD32 *cuMemsetD32;
tcuMemsetD2D8 *cuMemsetD2D8;
tcuMemsetD2D16 *cuMemsetD2D16;
tcuMemsetD2D32 *cuMemsetD2D32;
tcuFuncSetBlockShape *cuFuncSetBlockShape;
tcuFuncSetSharedSize *cuFuncSetSharedSize;
tcuFuncGetAttribute *cuFuncGetAttribute;
tcuFuncSetCacheConfig *cuFuncSetCacheConfig;
tcuFuncSetSharedMemConfig *cuFuncSetSharedMemConfig;
tcuLaunchKernel *cuLaunchKernel;
tcuArrayCreate *cuArrayCreate;
tcuArrayGetDescriptor *cuArrayGetDescriptor;
tcuArrayDestroy *cuArrayDestroy;
tcuArray3DCreate *cuArray3DCreate;
tcuArray3DGetDescriptor *cuArray3DGetDescriptor;
tcuTexRefCreate *cuTexRefCreate;
tcuTexRefDestroy *cuTexRefDestroy;
tcuTexRefSetArray *cuTexRefSetArray;
tcuTexRefSetAddress *cuTexRefSetAddress;
tcuTexRefSetAddress2D *cuTexRefSetAddress2D;
tcuTexRefSetFormat *cuTexRefSetFormat;
tcuTexRefSetAddressMode *cuTexRefSetAddressMode;
tcuTexRefSetFilterMode *cuTexRefSetFilterMode;
tcuTexRefSetFlags *cuTexRefSetFlags;
tcuTexRefGetAddress *cuTexRefGetAddress;
tcuTexRefGetArray *cuTexRefGetArray;
tcuTexRefGetAddressMode *cuTexRefGetAddressMode;
tcuTexRefGetFilterMode *cuTexRefGetFilterMode;
tcuTexRefGetFormat *cuTexRefGetFormat;
tcuTexRefGetFlags *cuTexRefGetFlags;
tcuSurfRefSetArray *cuSurfRefSetArray;
tcuSurfRefGetArray *cuSurfRefGetArray;
tcuParamSetSize *cuParamSetSize;
tcuParamSeti *cuParamSeti;
tcuParamSetf *cuParamSetf;
tcuParamSetv *cuParamSetv;
tcuParamSetTexRef *cuParamSetTexRef;
tcuLaunch *cuLaunch;
tcuLaunchGrid *cuLaunchGrid;
tcuLaunchGridAsync *cuLaunchGridAsync;
tcuEventCreate *cuEventCreate;
tcuEventRecord *cuEventRecord;
tcuEventQuery *cuEventQuery;
tcuEventSynchronize *cuEventSynchronize;
tcuEventDestroy *cuEventDestroy;
tcuEventElapsedTime *cuEventElapsedTime;
tcuStreamCreate *cuStreamCreate;
tcuStreamWaitEvent *cuStreamWaitEvent;
tcuStreamAddCallback *cuStreamAddCallback;
tcuStreamQuery *cuStreamQuery;
tcuStreamSynchronize *cuStreamSynchronize;
tcuStreamDestroy *cuStreamDestroy;
tcuGraphicsUnregisterResource *cuGraphicsUnregisterResource;
tcuGraphicsSubResourceGetMappedArray *cuGraphicsSubResourceGetMappedArray;
tcuGraphicsResourceGetMappedPointer *cuGraphicsResourceGetMappedPointer;
tcuGraphicsResourceSetMapFlags *cuGraphicsResourceSetMapFlags;
tcuGraphicsMapResources *cuGraphicsMapResources;
tcuGraphicsUnmapResources *cuGraphicsUnmapResources;
tcuGetExportTable *cuGetExportTable;
tcuCtxSetLimit *cuCtxSetLimit;
tcuCtxGetLimit *cuCtxGetLimit;
tcuCtxGetCacheConfig *cuCtxGetCacheConfig;
tcuCtxSetCacheConfig *cuCtxSetCacheConfig;
tcuCtxGetSharedMemConfig *cuCtxGetSharedMemConfig;
tcuCtxSetSharedMemConfig *cuCtxSetSharedMemConfig;
tcuCtxGetApiVersion *cuCtxGetApiVersion;
tcuMipmappedArrayCreate *cuMipmappedArrayCreate;
tcuMipmappedArrayGetLevel *cuMipmappedArrayGetLevel;
tcuMipmappedArrayDestroy *cuMipmappedArrayDestroy;
tcuProfilerStop *cuProfilerStop;
#ifdef CUDA_INIT_D3D9
// D3D9/CUDA interop (CUDA 1.x compatible API). These functions
// are deprecated; please use the ones below
tcuD3D9Begin *cuD3D9Begin;
tcuD3D9End *cuD3DEnd;
tcuD3D9RegisterVertexBuffer *cuD3D9RegisterVertexBuffer;
tcuD3D9MapVertexBuffer *cuD3D9MapVertexBuffer;
tcuD3D9UnmapVertexBuffer *cuD3D9UnmapVertexBuffer;
tcuD3D9UnregisterVertexBuffer *cuD3D9UnregisterVertexBuffer;
// D3D9/CUDA interop (CUDA 2.x compatible)
tcuD3D9GetDirect3DDevice *cuD3D9GetDirect3DDevice;
tcuD3D9RegisterResource *cuD3D9RegisterResource;
tcuD3D9UnregisterResource *cuD3D9UnregisterResource;
tcuD3D9MapResources *cuD3D9MapResources;
tcuD3D9UnmapResources *cuD3D9UnmapResources;
tcuD3D9ResourceSetMapFlags *cuD3D9ResourceSetMapFlags;
tcuD3D9ResourceGetSurfaceDimensions *cuD3D9ResourceGetSurfaceDimensions;
tcuD3D9ResourceGetMappedArray *cuD3D9ResourceGetMappedArray;
tcuD3D9ResourceGetMappedPointer *cuD3D9ResourceGetMappedPointer;
tcuD3D9ResourceGetMappedSize *cuD3D9ResourceGetMappedSize;
tcuD3D9ResourceGetMappedPitch *cuD3D9ResourceGetMappedPitch;
// D3D9/CUDA interop (CUDA 2.0+)
tcuD3D9GetDevice *cuD3D9GetDevice;
tcuD3D9CtxCreate *cuD3D9CtxCreate;
tcuGraphicsD3D9RegisterResource *cuGraphicsD3D9RegisterResource;
#endif
#ifdef CUDA_INIT_D3D10
// D3D10/CUDA interop (CUDA 3.0+)
tcuD3D10GetDevice *cuD3D10GetDevice;
tcuD3D10CtxCreate *cuD3D10CtxCreate;
tcuGraphicsD3D10RegisterResource *cuGraphicsD3D10RegisterResource;
#endif
#ifdef CUDA_INIT_D3D11
// D3D11/CUDA interop (CUDA 3.0+)
tcuD3D11GetDevice *cuD3D11GetDevice;
tcuD3D11CtxCreate *cuD3D11CtxCreate;
tcuGraphicsD3D11RegisterResource *cuGraphicsD3D11RegisterResource;
#endif
// GL/CUDA interop
#ifdef CUDA_INIT_OPENGL
tcuGLCtxCreate *cuGLCtxCreate;
tcuGraphicsGLRegisterBuffer *cuGraphicsGLRegisterBuffer;
tcuGraphicsGLRegisterImage *cuGraphicsGLRegisterImage;
#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
tcuWGLGetDevice *cuWGLGetDevice;
#endif
#endif
#define STRINGIFY(X) #X
#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
#include <Windows.h>
#ifdef UNICODE
static LPCWSTR __CudaLibName = L"nvcuda.dll";
#else
static LPCSTR __CudaLibName = "nvcuda.dll";
#endif
typedef HMODULE CUDADRIVER;
static CUresult LOAD_LIBRARY(CUDADRIVER *pInstance)
{
*pInstance = LoadLibrary(__CudaLibName);
if (*pInstance == NULL)
{
printf("LoadLibrary \"%s\" failed!\n", __CudaLibName);
return CUDA_ERROR_UNKNOWN;
}
return CUDA_SUCCESS;
}
#define GET_PROC_EX(name, alias, required) \
alias = (t##name *)GetProcAddress(CudaDrvLib, #name); \
if (alias == NULL && required) { \
printf("Failed to find required function \"%s\" in %s\n", \
#name, __CudaLibName); \
return CUDA_ERROR_UNKNOWN; \
}
#define GET_PROC_EX_V2(name, alias, required) \
alias = (t##name *)GetProcAddress(CudaDrvLib, STRINGIFY(name##_v2));\
if (alias == NULL && required) { \
printf("Failed to find required function \"%s\" in %s\n", \
STRINGIFY(name##_v2), __CudaLibName); \
return CUDA_ERROR_UNKNOWN; \
}
#define GET_PROC_EX_V3(name, alias, required) \
alias = (t##name *)GetProcAddress(CudaDrvLib, STRINGIFY(name##_v3));\
if (alias == NULL && required) { \
printf("Failed to find required function \"%s\" in %s\n", \
STRINGIFY(name##_v3), __CudaLibName); \
return CUDA_ERROR_UNKNOWN; \
}
#elif defined(__unix__) || defined (__QNX__) || defined(__APPLE__) || defined(__MACOSX)
#include <dlfcn.h>
#if defined(__APPLE__) || defined(__MACOSX)
static char __CudaLibName[] = "/usr/local/cuda/lib/libcuda.dylib";
#elif defined(__ANDROID__)
#if defined (__aarch64__)
static char __CudaLibName[] = "/system/vendor/lib64/libcuda.so";
#elif defined(__arm__)
static char __CudaLibName[] = "/system/vendor/lib/libcuda.so";
#endif
#else
static char __CudaLibName[] = "libcuda.so.1";
#endif
typedef void *CUDADRIVER;
static CUresult LOAD_LIBRARY(CUDADRIVER *pInstance)
{
*pInstance = dlopen(__CudaLibName, RTLD_NOW);
if (*pInstance == NULL)
{
printf("dlopen \"%s\" failed!\n", __CudaLibName);
return CUDA_ERROR_UNKNOWN;
}
return CUDA_SUCCESS;
}
#define GET_PROC_EX(name, alias, required) \
alias = (t##name *)dlsym(CudaDrvLib, #name); \
if (alias == NULL && required) { \
printf("Failed to find required function \"%s\" in %s\n", \
#name, __CudaLibName); \
return CUDA_ERROR_UNKNOWN; \
}
#define GET_PROC_EX_V2(name, alias, required) \
alias = (t##name *)dlsym(CudaDrvLib, STRINGIFY(name##_v2)); \
if (alias == NULL && required) { \
printf("Failed to find required function \"%s\" in %s\n", \
STRINGIFY(name##_v2), __CudaLibName); \
return CUDA_ERROR_UNKNOWN; \
}
#define GET_PROC_EX_V3(name, alias, required) \
alias = (t##name *)dlsym(CudaDrvLib, STRINGIFY(name##_v3)); \
if (alias == NULL && required) { \
printf("Failed to find required function \"%s\" in %s\n", \
STRINGIFY(name##_v3), __CudaLibName); \
return CUDA_ERROR_UNKNOWN; \
}
#else
#error unsupported platform
#endif
#define CHECKED_CALL(call) \
do { \
CUresult result = (call); \
if (CUDA_SUCCESS != result) { \
return result; \
} \
} while(0)
#define GET_PROC_REQUIRED(name) GET_PROC_EX(name,name,1)
#define GET_PROC_OPTIONAL(name) GET_PROC_EX(name,name,0)
#define GET_PROC(name) GET_PROC_REQUIRED(name)
#define GET_PROC_V2(name) GET_PROC_EX_V2(name,name,1)
#define GET_PROC_V3(name) GET_PROC_EX_V3(name,name,1)
CUresult CUDAAPI cuInit(unsigned int Flags, int cudaVersion)
{
CUDADRIVER CudaDrvLib;
int driverVer = 1000;
CHECKED_CALL(LOAD_LIBRARY(&CudaDrvLib));
// cuInit is required; alias it to _cuInit
GET_PROC_EX(cuInit, _cuInit, 1);
CHECKED_CALL(_cuInit(Flags));
// available since 2.2. if not present, version 1.0 is assumed
GET_PROC_OPTIONAL(cuDriverGetVersion);
if (cuDriverGetVersion)
{
CHECKED_CALL(cuDriverGetVersion(&driverVer));
}
// fetch all function pointers
GET_PROC(cuDeviceGet);
GET_PROC(cuDeviceGetCount);
GET_PROC(cuDeviceGetName);
GET_PROC(cuDeviceComputeCapability);
GET_PROC(cuDeviceGetProperties);
GET_PROC(cuDeviceGetAttribute);
GET_PROC(cuGetErrorString);
GET_PROC(cuCtxDestroy);
GET_PROC(cuCtxAttach);
GET_PROC(cuCtxDetach);
GET_PROC(cuCtxPushCurrent);
GET_PROC(cuCtxPopCurrent);
GET_PROC(cuCtxGetDevice);
GET_PROC(cuCtxSynchronize);
GET_PROC(cuCtxSetLimit);
GET_PROC(cuCtxGetCacheConfig);
GET_PROC(cuCtxSetCacheConfig);
GET_PROC(cuCtxGetApiVersion);
GET_PROC(cuModuleLoad);
GET_PROC(cuModuleLoadData);
GET_PROC(cuModuleUnload);
GET_PROC(cuModuleGetFunction);
GET_PROC(cuModuleGetTexRef);
GET_PROC(cuMemFreeHost);
GET_PROC(cuMemHostAlloc);
GET_PROC(cuFuncSetBlockShape);
GET_PROC(cuFuncSetSharedSize);
GET_PROC(cuFuncGetAttribute);
GET_PROC(cuArrayDestroy);
GET_PROC(cuTexRefCreate);
GET_PROC(cuTexRefDestroy);
GET_PROC(cuTexRefSetArray);
GET_PROC(cuTexRefSetFormat);
GET_PROC(cuTexRefSetAddressMode);
GET_PROC(cuTexRefSetFilterMode);
GET_PROC(cuTexRefSetFlags);
GET_PROC(cuTexRefGetArray);
GET_PROC(cuTexRefGetAddressMode);
GET_PROC(cuTexRefGetFilterMode);
GET_PROC(cuTexRefGetFormat);
GET_PROC(cuTexRefGetFlags);
GET_PROC(cuParamSetSize);
GET_PROC(cuParamSeti);
GET_PROC(cuParamSetf);
GET_PROC(cuParamSetv);
GET_PROC(cuParamSetTexRef);
GET_PROC(cuLaunch);
GET_PROC(cuLaunchGrid);
GET_PROC(cuLaunchGridAsync);
GET_PROC(cuEventCreate);
GET_PROC(cuEventRecord);
GET_PROC(cuEventQuery);
GET_PROC(cuEventSynchronize);
GET_PROC(cuEventDestroy);
GET_PROC(cuEventElapsedTime);
GET_PROC(cuStreamCreate);
GET_PROC(cuStreamWaitEvent);
GET_PROC(cuStreamAddCallback);
GET_PROC(cuStreamQuery);
GET_PROC(cuStreamSynchronize);
GET_PROC(cuStreamDestroy);
// These are CUDA 5.0 new functions
if (driverVer >= 5000)
{
GET_PROC(cuMipmappedArrayCreate);
GET_PROC(cuMipmappedArrayDestroy);
GET_PROC(cuMipmappedArrayGetLevel);
}
// These are CUDA 4.2 new functions
if (driverVer >= 4020)
{
GET_PROC(cuFuncSetSharedMemConfig);
GET_PROC(cuCtxGetSharedMemConfig);
GET_PROC(cuCtxSetSharedMemConfig);
}
// These are CUDA 4.1 new functions
if (cudaVersion >= 4010 && __CUDA_API_VERSION >= 4010)
{
GET_PROC(cuDeviceGetByPCIBusId);
GET_PROC(cuDeviceGetPCIBusId);
GET_PROC(cuIpcGetEventHandle);
GET_PROC(cuIpcOpenEventHandle);
GET_PROC(cuIpcGetMemHandle);
GET_PROC(cuIpcOpenMemHandle);
GET_PROC(cuIpcCloseMemHandle);
}
// These could be _v2 interfaces
if (cudaVersion >= 4000 && __CUDA_API_VERSION >= 4000)
{
GET_PROC_V2(cuCtxDestroy);
GET_PROC_V2(cuCtxPopCurrent);
GET_PROC_V2(cuCtxPushCurrent);
GET_PROC_V2(cuStreamDestroy);
GET_PROC_V2(cuEventDestroy);
}
if (cudaVersion >= 3020 && __CUDA_API_VERSION >= 3020)
{
GET_PROC_V2(cuDeviceTotalMem);
GET_PROC_V2(cuCtxCreate);
GET_PROC_V2(cuModuleGetGlobal);
GET_PROC_V2(cuMemGetInfo);
GET_PROC_V2(cuMemAlloc);
GET_PROC_V2(cuMemAllocPitch);
GET_PROC_V2(cuMemFree);
GET_PROC_V2(cuMemGetAddressRange);
GET_PROC_V2(cuMemAllocHost);
GET_PROC_V2(cuMemHostGetDevicePointer);
GET_PROC_V2(cuMemcpyHtoD);
GET_PROC_V2(cuMemcpyDtoH);
GET_PROC_V2(cuMemcpyDtoD);
GET_PROC_V2(cuMemcpyDtoA);
GET_PROC_V2(cuMemcpyAtoD);
GET_PROC_V2(cuMemcpyHtoA);
GET_PROC_V2(cuMemcpyAtoH);
GET_PROC_V2(cuMemcpyAtoA);
GET_PROC_V2(cuMemcpy2D);
GET_PROC_V2(cuMemcpy2DUnaligned);
GET_PROC_V2(cuMemcpy3D);
GET_PROC_V2(cuMemcpyHtoDAsync);
GET_PROC_V2(cuMemcpyDtoHAsync);
GET_PROC_V2(cuMemcpyHtoAAsync);
GET_PROC_V2(cuMemcpyAtoHAsync);
GET_PROC_V2(cuMemcpy2DAsync);
GET_PROC_V2(cuMemcpy3DAsync);
GET_PROC_V2(cuMemsetD8);
GET_PROC_V2(cuMemsetD16);
GET_PROC_V2(cuMemsetD32);
GET_PROC_V2(cuMemsetD2D8);
GET_PROC_V2(cuMemsetD2D16);
GET_PROC_V2(cuMemsetD2D32);
GET_PROC_V2(cuArrayCreate);
GET_PROC_V2(cuArrayGetDescriptor);
GET_PROC_V2(cuArray3DCreate);
GET_PROC_V2(cuArray3DGetDescriptor);
GET_PROC_V2(cuTexRefSetAddress);
GET_PROC_V2(cuTexRefGetAddress);
if (cudaVersion >= 4010 && __CUDA_API_VERSION >= 4010)
{
GET_PROC_V3(cuTexRefSetAddress2D);
}
else
{
GET_PROC_V2(cuTexRefSetAddress2D);
}
}
else
{
// versions earlier than 3020
GET_PROC(cuDeviceTotalMem);
GET_PROC(cuCtxCreate);
GET_PROC(cuModuleGetGlobal);
GET_PROC(cuMemGetInfo);
GET_PROC(cuMemAlloc);
GET_PROC(cuMemAllocPitch);
GET_PROC(cuMemFree);
GET_PROC(cuMemGetAddressRange);
GET_PROC(cuMemAllocHost);
GET_PROC(cuMemHostGetDevicePointer);
GET_PROC(cuMemcpyHtoD);
GET_PROC(cuMemcpyDtoH);
GET_PROC(cuMemcpyDtoD);
GET_PROC(cuMemcpyDtoA);
GET_PROC(cuMemcpyAtoD);
GET_PROC(cuMemcpyHtoA);
GET_PROC(cuMemcpyAtoH);
GET_PROC(cuMemcpyAtoA);
GET_PROC(cuMemcpy2D);
GET_PROC(cuMemcpy2DUnaligned);
GET_PROC(cuMemcpy3D);
GET_PROC(cuMemcpyHtoDAsync);
GET_PROC(cuMemcpyDtoHAsync);
GET_PROC(cuMemcpyHtoAAsync);
GET_PROC(cuMemcpyAtoHAsync);
GET_PROC(cuMemcpy2DAsync);
GET_PROC(cuMemcpy3DAsync);
GET_PROC(cuMemsetD8);
GET_PROC(cuMemsetD16);
GET_PROC(cuMemsetD32);
GET_PROC(cuMemsetD2D8);
GET_PROC(cuMemsetD2D16);
GET_PROC(cuMemsetD2D32);
GET_PROC(cuArrayCreate);
GET_PROC(cuArrayGetDescriptor);
GET_PROC(cuArray3DCreate);
GET_PROC(cuArray3DGetDescriptor);
GET_PROC(cuTexRefSetAddress);
GET_PROC(cuTexRefSetAddress2D);
GET_PROC(cuTexRefGetAddress);
}
// The following functions are specific to CUDA versions
if (driverVer >= 4000)
{
GET_PROC(cuCtxSetCurrent);
GET_PROC(cuCtxGetCurrent);
GET_PROC(cuMemHostRegister);
GET_PROC(cuMemHostUnregister);
GET_PROC(cuMemcpy);
GET_PROC(cuMemcpyPeer);
GET_PROC(cuLaunchKernel);
GET_PROC(cuProfilerStop);
}
if (driverVer >= 3010)
{
GET_PROC(cuModuleGetSurfRef);
GET_PROC(cuSurfRefSetArray);
GET_PROC(cuSurfRefGetArray);
GET_PROC(cuCtxSetLimit);
GET_PROC(cuCtxGetLimit);
}
if (driverVer >= 3000)
{
GET_PROC(cuMemcpyDtoDAsync);
GET_PROC(cuFuncSetCacheConfig);
#ifdef CUDA_INIT_D3D11
GET_PROC(cuD3D11GetDevice);
GET_PROC(cuD3D11CtxCreate);
GET_PROC(cuGraphicsD3D11RegisterResource);
#endif
GET_PROC(cuGraphicsUnregisterResource);
GET_PROC(cuGraphicsSubResourceGetMappedArray);
if (cudaVersion >= 3020 && __CUDA_API_VERSION >= 3020)
{
GET_PROC_V2(cuGraphicsResourceGetMappedPointer);
}
else
{
GET_PROC(cuGraphicsResourceGetMappedPointer);
}
GET_PROC(cuGraphicsResourceSetMapFlags);
GET_PROC(cuGraphicsMapResources);
GET_PROC(cuGraphicsUnmapResources);
GET_PROC(cuGetExportTable);
}
if (driverVer >= 2030)
{
GET_PROC(cuMemHostGetFlags);
#ifdef CUDA_INIT_D3D10
GET_PROC(cuD3D10GetDevice);
GET_PROC(cuD3D10CtxCreate);
GET_PROC(cuGraphicsD3D10RegisterResource);
#endif
#ifdef CUDA_INIT_OPENGL
GET_PROC(cuGraphicsGLRegisterBuffer);
GET_PROC(cuGraphicsGLRegisterImage);
#endif
}
if (driverVer >= 2010)
{
GET_PROC(cuModuleLoadDataEx);
GET_PROC(cuModuleLoadFatBinary);
#ifdef CUDA_INIT_OPENGL
GET_PROC(cuGLCtxCreate);
GET_PROC(cuGraphicsGLRegisterBuffer);
GET_PROC(cuGraphicsGLRegisterImage);
# ifdef WIN32
GET_PROC(cuWGLGetDevice);
# endif
#endif
#ifdef CUDA_INIT_D3D9
GET_PROC(cuD3D9GetDevice);
GET_PROC(cuD3D9CtxCreate);
GET_PROC(cuGraphicsD3D9RegisterResource);
#endif
}
return CUDA_SUCCESS;
}

View File

@@ -0,0 +1,18 @@
/*
* Copyright 1993-2015 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and related documentation outside the terms of the EULA
* is strictly prohibited.
*
*/
#ifndef __cuda_drvapi_dynlink_h__
#define __cuda_drvapi_dynlink_h__
#include "cuda_drvapi_dynlink_cuda.h"
#endif //__cuda_drvapi_dynlink_h__

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
The auto-generated pair of files named matrixMul_ptxdump.c and
matrixMul_ptxdump.h can be acquired by treating matrixMul_kernel.ptx
as binary file and representing its contents as an array of chars.
An example of the script written in Python language that performs
such translation can be found in "extras" directory of the sample.
The matrixMul_kernel.ptx contains the same PTX code as the file in
"data" directory of matrixMulDrv sample after compilation by nvcc.
The command line for generation using Python script is as follows:
> python ptx2c.py matrixMul_kernel.ptx matrixMul

View File

@@ -0,0 +1,727 @@
.version 1.4
.target sm_20, map_f64_to_f32
// compiled with C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\\bin/../open64/lib//be.exe
// nvopencc 4.0 built on 2011-02-21
//-----------------------------------------------------------
// Compiling C:/Users/EYOUNG~1.COM/AppData/Local/Temp/tmpxft_000014c0_00000000-11_matrixMul_kernel.cpp3.i (C:/Users/EYOUNG~1.COM/AppData/Local/Temp/ccBI#.a04000)
//-----------------------------------------------------------
//-----------------------------------------------------------
// Options:
//-----------------------------------------------------------
// Target:ptx, ISA:sm_20, Endian:little, Pointer Size:32
// -O3 (Optimization level)
// -g0 (Debug level)
// -m2 (Report advisories)
//-----------------------------------------------------------
.shared .align 4 .b8 __cuda_local_var_87382_38_non_const_As__6[1024];
.shared .align 4 .b8 __cuda_local_var_87386_38_non_const_Bs__7[1024];
.entry matrixMul_bs16_32bit (
.param .u32 __cudaparm_matrixMul_bs16_32bit_C,
.param .u32 __cudaparm_matrixMul_bs16_32bit_A,
.param .u32 __cudaparm_matrixMul_bs16_32bit_B,
.param .s32 __cudaparm_matrixMul_bs16_32bit_wA,
.param .s32 __cudaparm_matrixMul_bs16_32bit_wB)
{
.reg .u32 %r<57>;
.reg .f32 %f<52>;
.reg .pred %p<4>;
.loc 16 107 0
$LDWbegin_matrixMul_bs16_32bit:
.loc 16 66 0
cvt.s32.u16 %r1, %ctaid.x;
mul24.lo.s32 %r2, %r1, 16;
cvt.s32.u16 %r3, %ctaid.y;
ld.param.s32 %r4, [__cudaparm_matrixMul_bs16_32bit_wA];
mul.lo.s32 %r5, %r3, %r4;
mul.lo.s32 %r6, %r5, 16;
add.s32 %r7, %r6, %r4;
sub.s32 %r8, %r7, 1;
cvt.s32.u16 %r9, %tid.x;
cvt.s32.u16 %r10, %tid.y;
ld.param.s32 %r11, [__cudaparm_matrixMul_bs16_32bit_wB];
setp.lt.s32 %p1, %r8, %r6;
@%p1 bra $Lt_0_3330;
mov.u32 %r12, __cuda_local_var_87382_38_non_const_As__6;
mov.u32 %r13, __cuda_local_var_87386_38_non_const_Bs__7;
ld.param.s32 %r4, [__cudaparm_matrixMul_bs16_32bit_wA];
add.s32 %r14, %r4, 15;
shr.s32 %r15, %r14, 31;
mov.s32 %r16, 15;
and.b32 %r17, %r15, %r16;
add.s32 %r18, %r17, %r14;
shr.s32 %r19, %r18, 4;
ld.param.s32 %r11, [__cudaparm_matrixMul_bs16_32bit_wB];
mul.lo.s32 %r20, %r10, %r11;
mul.lo.s32 %r21, %r10, %r4;
mul24.lo.u32 %r22, %r10, 16;
mul24.lo.u32 %r23, %r10, 64;
mul24.lo.u32 %r24, %r9, 4;
mul.lo.s32 %r25, %r11, 16;
add.s32 %r26, %r20, %r2;
add.s32 %r27, %r21, %r6;
add.u32 %r28, %r9, %r22;
add.u32 %r29, %r23, %r12;
add.u32 %r30, %r24, %r13;
add.s32 %r31, %r26, %r9;
add.s32 %r32, %r27, %r9;
mul.lo.u32 %r33, %r28, 4;
mul.lo.u32 %r34, %r31, 4;
mul.lo.u32 %r35, %r25, 4;
mul.lo.u32 %r36, %r32, 4;
add.u32 %r37, %r33, %r12;
add.u32 %r38, %r33, %r13;
add.s32 %r39, %r21, %r8;
ld.param.u32 %r40, [__cudaparm_matrixMul_bs16_32bit_B];
add.u32 %r41, %r40, %r34;
ld.param.u32 %r42, [__cudaparm_matrixMul_bs16_32bit_A];
add.u32 %r43, %r36, %r42;
add.s32 %r44, %r39, %r9;
mul.lo.u32 %r45, %r44, 4;
add.u32 %r46, %r45, %r42;
mov.f32 %f1, 0f00000000; // 0
mov.s32 %r47, %r19;
$Lt_0_2818:
//<loop> Loop body line 66, nesting depth: 1, estimated iterations: unknown
.loc 16 81 0
ld.global.f32 %f2, [%r43+0];
st.shared.f32 [%r37+0], %f2;
.loc 16 82 0
ld.global.f32 %f3, [%r41+0];
st.shared.f32 [%r38+0], %f3;
.loc 16 85 0
bar.sync 0;
.loc 16 92 0
ld.shared.f32 %f4, [%r29+0];
ld.shared.f32 %f5, [%r30+0];
mad.f32 %f6, %f4, %f5, %f1;
ld.shared.f32 %f7, [%r29+4];
ld.shared.f32 %f8, [%r30+64];
mad.f32 %f9, %f7, %f8, %f6;
ld.shared.f32 %f10, [%r29+8];
ld.shared.f32 %f11, [%r30+128];
mad.f32 %f12, %f10, %f11, %f9;
ld.shared.f32 %f13, [%r29+12];
ld.shared.f32 %f14, [%r30+192];
mad.f32 %f15, %f13, %f14, %f12;
ld.shared.f32 %f16, [%r29+16];
ld.shared.f32 %f17, [%r30+256];
mad.f32 %f18, %f16, %f17, %f15;
ld.shared.f32 %f19, [%r29+20];
ld.shared.f32 %f20, [%r30+320];
mad.f32 %f21, %f19, %f20, %f18;
ld.shared.f32 %f22, [%r29+24];
ld.shared.f32 %f23, [%r30+384];
mad.f32 %f24, %f22, %f23, %f21;
ld.shared.f32 %f25, [%r29+28];
ld.shared.f32 %f26, [%r30+448];
mad.f32 %f27, %f25, %f26, %f24;
ld.shared.f32 %f28, [%r29+32];
ld.shared.f32 %f29, [%r30+512];
mad.f32 %f30, %f28, %f29, %f27;
ld.shared.f32 %f31, [%r29+36];
ld.shared.f32 %f32, [%r30+576];
mad.f32 %f33, %f31, %f32, %f30;
ld.shared.f32 %f34, [%r29+40];
ld.shared.f32 %f35, [%r30+640];
mad.f32 %f36, %f34, %f35, %f33;
ld.shared.f32 %f37, [%r29+44];
ld.shared.f32 %f38, [%r30+704];
mad.f32 %f39, %f37, %f38, %f36;
ld.shared.f32 %f40, [%r29+48];
ld.shared.f32 %f41, [%r30+768];
mad.f32 %f42, %f40, %f41, %f39;
ld.shared.f32 %f43, [%r29+52];
ld.shared.f32 %f44, [%r30+832];
mad.f32 %f45, %f43, %f44, %f42;
ld.shared.f32 %f46, [%r29+56];
ld.shared.f32 %f47, [%r30+896];
mad.f32 %f48, %f46, %f47, %f45;
ld.shared.f32 %f49, [%r29+60];
ld.shared.f32 %f50, [%r30+960];
mad.f32 %f1, %f49, %f50, %f48;
.loc 16 97 0
bar.sync 0;
.loc 16 66 0
add.u32 %r41, %r35, %r41;
add.u32 %r43, %r43, 64;
setp.le.u32 %p2, %r43, %r46;
@%p2 bra $Lt_0_2818;
bra.uni $Lt_0_2306;
$Lt_0_3330:
ld.param.s32 %r11, [__cudaparm_matrixMul_bs16_32bit_wB];
mul.lo.s32 %r20, %r10, %r11;
mov.f32 %f1, 0f00000000; // 0
$Lt_0_2306:
.loc 16 103 0
ld.param.u32 %r48, [__cudaparm_matrixMul_bs16_32bit_C];
mul.lo.s32 %r49, %r11, %r3;
add.s32 %r50, %r1, %r49;
mul.lo.s32 %r51, %r50, 16;
add.s32 %r52, %r20, %r51;
add.s32 %r53, %r9, %r52;
mul.lo.u32 %r54, %r53, 4;
add.u32 %r55, %r48, %r54;
st.global.f32 [%r55+0], %f1;
.loc 16 110 0
exit;
$LDWend_matrixMul_bs16_32bit:
} // matrixMul_bs16_32bit
.shared .align 4 .b8 __cuda_local_var_87382_38_non_const_As__4[1024];
.shared .align 4 .b8 __cuda_local_var_87386_38_non_const_Bs__5[1024];
.entry matrixMul_bs16_64bit (
.param .u32 __cudaparm_matrixMul_bs16_64bit_C,
.param .u32 __cudaparm_matrixMul_bs16_64bit_A,
.param .u32 __cudaparm_matrixMul_bs16_64bit_B,
.param .u32 __cudaparm_matrixMul_bs16_64bit_wA,
.param .u32 __cudaparm_matrixMul_bs16_64bit_wB)
{
.reg .u32 %r<54>;
.reg .f32 %f<52>;
.reg .pred %p<4>;
.loc 16 111 0
$LDWbegin_matrixMul_bs16_64bit:
.loc 16 66 0
cvt.u32.u16 %r1, %ctaid.x;
mul24.lo.u32 %r2, %r1, 16;
cvt.u32.u16 %r3, %ctaid.y;
ld.param.u32 %r4, [__cudaparm_matrixMul_bs16_64bit_wA];
mul.lo.u32 %r5, %r3, %r4;
mul.lo.u32 %r6, %r5, 16;
mov.s32 %r7, %r6;
add.u32 %r8, %r6, %r4;
sub.u32 %r9, %r8, 1;
cvt.u32.u16 %r10, %tid.x;
cvt.u32.u16 %r11, %tid.y;
ld.param.u32 %r12, [__cudaparm_matrixMul_bs16_64bit_wB];
setp.lt.u32 %p1, %r9, %r6;
@%p1 bra $Lt_1_3330;
mov.u32 %r13, __cuda_local_var_87382_38_non_const_As__4;
mov.u32 %r14, __cuda_local_var_87386_38_non_const_Bs__5;
ld.param.u32 %r4, [__cudaparm_matrixMul_bs16_64bit_wA];
add.u32 %r15, %r4, 15;
shr.s32 %r16, %r15, 31;
mov.s32 %r17, 15;
and.b32 %r18, %r16, %r17;
add.s32 %r19, %r18, %r15;
shr.s32 %r20, %r19, 4;
ld.param.u32 %r12, [__cudaparm_matrixMul_bs16_64bit_wB];
mul.lo.u32 %r21, %r11, %r12;
mul.lo.u32 %r22, %r11, %r4;
mul24.lo.u32 %r23, %r11, 16;
mul24.lo.u32 %r24, %r11, 64;
mul24.lo.u32 %r25, %r10, 4;
mul.lo.u32 %r26, %r12, 16;
add.u32 %r27, %r21, %r2;
add.u32 %r28, %r22, %r6;
add.u32 %r29, %r23, %r10;
add.u32 %r30, %r24, %r13;
add.u32 %r31, %r25, %r14;
add.u32 %r32, %r27, %r10;
add.u32 %r33, %r28, %r10;
mul.lo.u32 %r34, %r29, 4;
mul.lo.u32 %r35, %r32, 4;
mul.lo.u32 %r36, %r26, 4;
mul.lo.u32 %r37, %r33, 4;
add.u32 %r38, %r34, %r13;
add.u32 %r39, %r34, %r14;
ld.param.u32 %r40, [__cudaparm_matrixMul_bs16_64bit_B];
add.u32 %r41, %r40, %r35;
ld.param.u32 %r42, [__cudaparm_matrixMul_bs16_64bit_A];
add.u32 %r43, %r42, %r37;
mov.f32 %f1, 0f00000000; // 0
mov.s32 %r44, %r20;
$Lt_1_2818:
//<loop> Loop body line 66, nesting depth: 1, estimated iterations: unknown
.loc 16 81 0
ld.global.f32 %f2, [%r43+0];
st.shared.f32 [%r38+0], %f2;
.loc 16 82 0
ld.global.f32 %f3, [%r41+0];
st.shared.f32 [%r39+0], %f3;
.loc 16 85 0
bar.sync 0;
.loc 16 92 0
ld.shared.f32 %f4, [%r30+0];
ld.shared.f32 %f5, [%r31+0];
mad.f32 %f6, %f4, %f5, %f1;
ld.shared.f32 %f7, [%r30+4];
ld.shared.f32 %f8, [%r31+64];
mad.f32 %f9, %f7, %f8, %f6;
ld.shared.f32 %f10, [%r30+8];
ld.shared.f32 %f11, [%r31+128];
mad.f32 %f12, %f10, %f11, %f9;
ld.shared.f32 %f13, [%r30+12];
ld.shared.f32 %f14, [%r31+192];
mad.f32 %f15, %f13, %f14, %f12;
ld.shared.f32 %f16, [%r30+16];
ld.shared.f32 %f17, [%r31+256];
mad.f32 %f18, %f16, %f17, %f15;
ld.shared.f32 %f19, [%r30+20];
ld.shared.f32 %f20, [%r31+320];
mad.f32 %f21, %f19, %f20, %f18;
ld.shared.f32 %f22, [%r30+24];
ld.shared.f32 %f23, [%r31+384];
mad.f32 %f24, %f22, %f23, %f21;
ld.shared.f32 %f25, [%r30+28];
ld.shared.f32 %f26, [%r31+448];
mad.f32 %f27, %f25, %f26, %f24;
ld.shared.f32 %f28, [%r30+32];
ld.shared.f32 %f29, [%r31+512];
mad.f32 %f30, %f28, %f29, %f27;
ld.shared.f32 %f31, [%r30+36];
ld.shared.f32 %f32, [%r31+576];
mad.f32 %f33, %f31, %f32, %f30;
ld.shared.f32 %f34, [%r30+40];
ld.shared.f32 %f35, [%r31+640];
mad.f32 %f36, %f34, %f35, %f33;
ld.shared.f32 %f37, [%r30+44];
ld.shared.f32 %f38, [%r31+704];
mad.f32 %f39, %f37, %f38, %f36;
ld.shared.f32 %f40, [%r30+48];
ld.shared.f32 %f41, [%r31+768];
mad.f32 %f42, %f40, %f41, %f39;
ld.shared.f32 %f43, [%r30+52];
ld.shared.f32 %f44, [%r31+832];
mad.f32 %f45, %f43, %f44, %f42;
ld.shared.f32 %f46, [%r30+56];
ld.shared.f32 %f47, [%r31+896];
mad.f32 %f48, %f46, %f47, %f45;
ld.shared.f32 %f49, [%r30+60];
ld.shared.f32 %f50, [%r31+960];
mad.f32 %f1, %f49, %f50, %f48;
.loc 16 97 0
bar.sync 0;
.loc 16 66 0
add.u32 %r41, %r36, %r41;
add.u32 %r7, %r7, 16;
add.u32 %r43, %r43, 64;
setp.ge.u32 %p2, %r9, %r7;
@%p2 bra $Lt_1_2818;
bra.uni $Lt_1_2306;
$Lt_1_3330:
ld.param.u32 %r12, [__cudaparm_matrixMul_bs16_64bit_wB];
mul.lo.u32 %r21, %r11, %r12;
mov.f32 %f1, 0f00000000; // 0
$Lt_1_2306:
.loc 16 103 0
ld.param.u32 %r45, [__cudaparm_matrixMul_bs16_64bit_C];
mul.lo.u32 %r46, %r12, %r3;
add.u32 %r47, %r1, %r46;
mul.lo.u32 %r48, %r47, 16;
add.u32 %r49, %r21, %r48;
add.u32 %r50, %r10, %r49;
mul.lo.u32 %r51, %r50, 4;
add.u32 %r52, %r45, %r51;
st.global.f32 [%r52+0], %f1;
.loc 16 114 0
exit;
$LDWend_matrixMul_bs16_64bit:
} // matrixMul_bs16_64bit
.shared .align 4 .b8 __cuda_local_var_87382_38_non_const_As__2[4096];
.shared .align 4 .b8 __cuda_local_var_87386_38_non_const_Bs__3[4096];
.entry matrixMul_bs32_32bit (
.param .u32 __cudaparm_matrixMul_bs32_32bit_C,
.param .u32 __cudaparm_matrixMul_bs32_32bit_A,
.param .u32 __cudaparm_matrixMul_bs32_32bit_B,
.param .s32 __cudaparm_matrixMul_bs32_32bit_wA,
.param .s32 __cudaparm_matrixMul_bs32_32bit_wB)
{
.reg .u32 %r<57>;
.reg .f32 %f<100>;
.reg .pred %p<4>;
.loc 16 115 0
$LDWbegin_matrixMul_bs32_32bit:
.loc 16 66 0
cvt.s32.u16 %r1, %ctaid.x;
mul24.lo.s32 %r2, %r1, 32;
cvt.s32.u16 %r3, %ctaid.y;
ld.param.s32 %r4, [__cudaparm_matrixMul_bs32_32bit_wA];
mul.lo.s32 %r5, %r3, %r4;
mul.lo.s32 %r6, %r5, 32;
add.s32 %r7, %r6, %r4;
sub.s32 %r8, %r7, 1;
cvt.s32.u16 %r9, %tid.x;
cvt.s32.u16 %r10, %tid.y;
ld.param.s32 %r11, [__cudaparm_matrixMul_bs32_32bit_wB];
setp.lt.s32 %p1, %r8, %r6;
@%p1 bra $Lt_2_3330;
mov.u32 %r12, __cuda_local_var_87382_38_non_const_As__2;
mov.u32 %r13, __cuda_local_var_87386_38_non_const_Bs__3;
ld.param.s32 %r4, [__cudaparm_matrixMul_bs32_32bit_wA];
add.s32 %r14, %r4, 31;
shr.s32 %r15, %r14, 31;
mov.s32 %r16, 31;
and.b32 %r17, %r15, %r16;
add.s32 %r18, %r17, %r14;
shr.s32 %r19, %r18, 5;
ld.param.s32 %r11, [__cudaparm_matrixMul_bs32_32bit_wB];
mul.lo.s32 %r20, %r10, %r11;
mul.lo.s32 %r21, %r10, %r4;
mul24.lo.u32 %r22, %r10, 32;
mul24.lo.u32 %r23, %r10, 128;
mul24.lo.u32 %r24, %r9, 4;
mul.lo.s32 %r25, %r11, 32;
add.s32 %r26, %r20, %r2;
add.s32 %r27, %r21, %r6;
add.u32 %r28, %r9, %r22;
add.u32 %r29, %r23, %r12;
add.u32 %r30, %r24, %r13;
add.s32 %r31, %r26, %r9;
add.s32 %r32, %r27, %r9;
mul.lo.u32 %r33, %r28, 4;
mul.lo.u32 %r34, %r31, 4;
mul.lo.u32 %r35, %r25, 4;
mul.lo.u32 %r36, %r32, 4;
add.u32 %r37, %r33, %r12;
add.u32 %r38, %r33, %r13;
add.s32 %r39, %r21, %r8;
ld.param.u32 %r40, [__cudaparm_matrixMul_bs32_32bit_B];
add.u32 %r41, %r40, %r34;
ld.param.u32 %r42, [__cudaparm_matrixMul_bs32_32bit_A];
add.u32 %r43, %r36, %r42;
add.s32 %r44, %r39, %r9;
mul.lo.u32 %r45, %r44, 4;
add.u32 %r46, %r45, %r42;
mov.f32 %f1, 0f00000000; // 0
mov.s32 %r47, %r19;
$Lt_2_2818:
//<loop> Loop body line 66, nesting depth: 1, estimated iterations: unknown
.loc 16 81 0
ld.global.f32 %f2, [%r43+0];
st.shared.f32 [%r37+0], %f2;
.loc 16 82 0
ld.global.f32 %f3, [%r41+0];
st.shared.f32 [%r38+0], %f3;
.loc 16 85 0
bar.sync 0;
.loc 16 92 0
ld.shared.f32 %f4, [%r29+0];
ld.shared.f32 %f5, [%r30+0];
mad.f32 %f6, %f4, %f5, %f1;
ld.shared.f32 %f7, [%r29+4];
ld.shared.f32 %f8, [%r30+128];
mad.f32 %f9, %f7, %f8, %f6;
ld.shared.f32 %f10, [%r29+8];
ld.shared.f32 %f11, [%r30+256];
mad.f32 %f12, %f10, %f11, %f9;
ld.shared.f32 %f13, [%r29+12];
ld.shared.f32 %f14, [%r30+384];
mad.f32 %f15, %f13, %f14, %f12;
ld.shared.f32 %f16, [%r29+16];
ld.shared.f32 %f17, [%r30+512];
mad.f32 %f18, %f16, %f17, %f15;
ld.shared.f32 %f19, [%r29+20];
ld.shared.f32 %f20, [%r30+640];
mad.f32 %f21, %f19, %f20, %f18;
ld.shared.f32 %f22, [%r29+24];
ld.shared.f32 %f23, [%r30+768];
mad.f32 %f24, %f22, %f23, %f21;
ld.shared.f32 %f25, [%r29+28];
ld.shared.f32 %f26, [%r30+896];
mad.f32 %f27, %f25, %f26, %f24;
ld.shared.f32 %f28, [%r29+32];
ld.shared.f32 %f29, [%r30+1024];
mad.f32 %f30, %f28, %f29, %f27;
ld.shared.f32 %f31, [%r29+36];
ld.shared.f32 %f32, [%r30+1152];
mad.f32 %f33, %f31, %f32, %f30;
ld.shared.f32 %f34, [%r29+40];
ld.shared.f32 %f35, [%r30+1280];
mad.f32 %f36, %f34, %f35, %f33;
ld.shared.f32 %f37, [%r29+44];
ld.shared.f32 %f38, [%r30+1408];
mad.f32 %f39, %f37, %f38, %f36;
ld.shared.f32 %f40, [%r29+48];
ld.shared.f32 %f41, [%r30+1536];
mad.f32 %f42, %f40, %f41, %f39;
ld.shared.f32 %f43, [%r29+52];
ld.shared.f32 %f44, [%r30+1664];
mad.f32 %f45, %f43, %f44, %f42;
ld.shared.f32 %f46, [%r29+56];
ld.shared.f32 %f47, [%r30+1792];
mad.f32 %f48, %f46, %f47, %f45;
ld.shared.f32 %f49, [%r29+60];
ld.shared.f32 %f50, [%r30+1920];
mad.f32 %f51, %f49, %f50, %f48;
ld.shared.f32 %f52, [%r29+64];
ld.shared.f32 %f53, [%r30+2048];
mad.f32 %f54, %f52, %f53, %f51;
ld.shared.f32 %f55, [%r29+68];
ld.shared.f32 %f56, [%r30+2176];
mad.f32 %f57, %f55, %f56, %f54;
ld.shared.f32 %f58, [%r29+72];
ld.shared.f32 %f59, [%r30+2304];
mad.f32 %f60, %f58, %f59, %f57;
ld.shared.f32 %f61, [%r29+76];
ld.shared.f32 %f62, [%r30+2432];
mad.f32 %f63, %f61, %f62, %f60;
ld.shared.f32 %f64, [%r29+80];
ld.shared.f32 %f65, [%r30+2560];
mad.f32 %f66, %f64, %f65, %f63;
ld.shared.f32 %f67, [%r29+84];
ld.shared.f32 %f68, [%r30+2688];
mad.f32 %f69, %f67, %f68, %f66;
ld.shared.f32 %f70, [%r29+88];
ld.shared.f32 %f71, [%r30+2816];
mad.f32 %f72, %f70, %f71, %f69;
ld.shared.f32 %f73, [%r29+92];
ld.shared.f32 %f74, [%r30+2944];
mad.f32 %f75, %f73, %f74, %f72;
ld.shared.f32 %f76, [%r29+96];
ld.shared.f32 %f77, [%r30+3072];
mad.f32 %f78, %f76, %f77, %f75;
ld.shared.f32 %f79, [%r29+100];
ld.shared.f32 %f80, [%r30+3200];
mad.f32 %f81, %f79, %f80, %f78;
ld.shared.f32 %f82, [%r29+104];
ld.shared.f32 %f83, [%r30+3328];
mad.f32 %f84, %f82, %f83, %f81;
ld.shared.f32 %f85, [%r29+108];
ld.shared.f32 %f86, [%r30+3456];
mad.f32 %f87, %f85, %f86, %f84;
ld.shared.f32 %f88, [%r29+112];
ld.shared.f32 %f89, [%r30+3584];
mad.f32 %f90, %f88, %f89, %f87;
ld.shared.f32 %f91, [%r29+116];
ld.shared.f32 %f92, [%r30+3712];
mad.f32 %f93, %f91, %f92, %f90;
ld.shared.f32 %f94, [%r29+120];
ld.shared.f32 %f95, [%r30+3840];
mad.f32 %f96, %f94, %f95, %f93;
ld.shared.f32 %f97, [%r29+124];
ld.shared.f32 %f98, [%r30+3968];
mad.f32 %f1, %f97, %f98, %f96;
.loc 16 97 0
bar.sync 0;
.loc 16 66 0
add.u32 %r41, %r35, %r41;
add.u32 %r43, %r43, 128;
setp.le.u32 %p2, %r43, %r46;
@%p2 bra $Lt_2_2818;
bra.uni $Lt_2_2306;
$Lt_2_3330:
ld.param.s32 %r11, [__cudaparm_matrixMul_bs32_32bit_wB];
mul.lo.s32 %r20, %r10, %r11;
mov.f32 %f1, 0f00000000; // 0
$Lt_2_2306:
.loc 16 103 0
ld.param.u32 %r48, [__cudaparm_matrixMul_bs32_32bit_C];
mul.lo.s32 %r49, %r11, %r3;
add.s32 %r50, %r1, %r49;
mul.lo.s32 %r51, %r50, 32;
add.s32 %r52, %r20, %r51;
add.s32 %r53, %r9, %r52;
mul.lo.u32 %r54, %r53, 4;
add.u32 %r55, %r48, %r54;
st.global.f32 [%r55+0], %f1;
.loc 16 118 0
exit;
$LDWend_matrixMul_bs32_32bit:
} // matrixMul_bs32_32bit
.shared .align 4 .b8 __cuda_local_var_87382_38_non_const_As__0[4096];
.shared .align 4 .b8 __cuda_local_var_87386_38_non_const_Bs__1[4096];
.entry matrixMul_bs32_64bit (
.param .u32 __cudaparm_matrixMul_bs32_64bit_C,
.param .u32 __cudaparm_matrixMul_bs32_64bit_A,
.param .u32 __cudaparm_matrixMul_bs32_64bit_B,
.param .u32 __cudaparm_matrixMul_bs32_64bit_wA,
.param .u32 __cudaparm_matrixMul_bs32_64bit_wB)
{
.reg .u32 %r<54>;
.reg .f32 %f<100>;
.reg .pred %p<4>;
.loc 16 119 0
$LDWbegin_matrixMul_bs32_64bit:
.loc 16 66 0
cvt.u32.u16 %r1, %ctaid.x;
mul24.lo.u32 %r2, %r1, 32;
cvt.u32.u16 %r3, %ctaid.y;
ld.param.u32 %r4, [__cudaparm_matrixMul_bs32_64bit_wA];
mul.lo.u32 %r5, %r3, %r4;
mul.lo.u32 %r6, %r5, 32;
mov.s32 %r7, %r6;
add.u32 %r8, %r6, %r4;
sub.u32 %r9, %r8, 1;
cvt.u32.u16 %r10, %tid.x;
cvt.u32.u16 %r11, %tid.y;
ld.param.u32 %r12, [__cudaparm_matrixMul_bs32_64bit_wB];
setp.lt.u32 %p1, %r9, %r6;
@%p1 bra $Lt_3_3330;
mov.u32 %r13, __cuda_local_var_87382_38_non_const_As__0;
mov.u32 %r14, __cuda_local_var_87386_38_non_const_Bs__1;
ld.param.u32 %r4, [__cudaparm_matrixMul_bs32_64bit_wA];
add.u32 %r15, %r4, 31;
shr.s32 %r16, %r15, 31;
mov.s32 %r17, 31;
and.b32 %r18, %r16, %r17;
add.s32 %r19, %r18, %r15;
shr.s32 %r20, %r19, 5;
ld.param.u32 %r12, [__cudaparm_matrixMul_bs32_64bit_wB];
mul.lo.u32 %r21, %r11, %r12;
mul.lo.u32 %r22, %r11, %r4;
mul24.lo.u32 %r23, %r11, 32;
mul24.lo.u32 %r24, %r11, 128;
mul24.lo.u32 %r25, %r10, 4;
mul.lo.u32 %r26, %r12, 32;
add.u32 %r27, %r21, %r2;
add.u32 %r28, %r22, %r6;
add.u32 %r29, %r23, %r10;
add.u32 %r30, %r24, %r13;
add.u32 %r31, %r25, %r14;
add.u32 %r32, %r27, %r10;
add.u32 %r33, %r28, %r10;
mul.lo.u32 %r34, %r29, 4;
mul.lo.u32 %r35, %r32, 4;
mul.lo.u32 %r36, %r26, 4;
mul.lo.u32 %r37, %r33, 4;
add.u32 %r38, %r34, %r13;
add.u32 %r39, %r34, %r14;
ld.param.u32 %r40, [__cudaparm_matrixMul_bs32_64bit_B];
add.u32 %r41, %r40, %r35;
ld.param.u32 %r42, [__cudaparm_matrixMul_bs32_64bit_A];
add.u32 %r43, %r42, %r37;
mov.f32 %f1, 0f00000000; // 0
mov.s32 %r44, %r20;
$Lt_3_2818:
//<loop> Loop body line 66, nesting depth: 1, estimated iterations: unknown
.loc 16 81 0
ld.global.f32 %f2, [%r43+0];
st.shared.f32 [%r38+0], %f2;
.loc 16 82 0
ld.global.f32 %f3, [%r41+0];
st.shared.f32 [%r39+0], %f3;
.loc 16 85 0
bar.sync 0;
.loc 16 92 0
ld.shared.f32 %f4, [%r30+0];
ld.shared.f32 %f5, [%r31+0];
mad.f32 %f6, %f4, %f5, %f1;
ld.shared.f32 %f7, [%r30+4];
ld.shared.f32 %f8, [%r31+128];
mad.f32 %f9, %f7, %f8, %f6;
ld.shared.f32 %f10, [%r30+8];
ld.shared.f32 %f11, [%r31+256];
mad.f32 %f12, %f10, %f11, %f9;
ld.shared.f32 %f13, [%r30+12];
ld.shared.f32 %f14, [%r31+384];
mad.f32 %f15, %f13, %f14, %f12;
ld.shared.f32 %f16, [%r30+16];
ld.shared.f32 %f17, [%r31+512];
mad.f32 %f18, %f16, %f17, %f15;
ld.shared.f32 %f19, [%r30+20];
ld.shared.f32 %f20, [%r31+640];
mad.f32 %f21, %f19, %f20, %f18;
ld.shared.f32 %f22, [%r30+24];
ld.shared.f32 %f23, [%r31+768];
mad.f32 %f24, %f22, %f23, %f21;
ld.shared.f32 %f25, [%r30+28];
ld.shared.f32 %f26, [%r31+896];
mad.f32 %f27, %f25, %f26, %f24;
ld.shared.f32 %f28, [%r30+32];
ld.shared.f32 %f29, [%r31+1024];
mad.f32 %f30, %f28, %f29, %f27;
ld.shared.f32 %f31, [%r30+36];
ld.shared.f32 %f32, [%r31+1152];
mad.f32 %f33, %f31, %f32, %f30;
ld.shared.f32 %f34, [%r30+40];
ld.shared.f32 %f35, [%r31+1280];
mad.f32 %f36, %f34, %f35, %f33;
ld.shared.f32 %f37, [%r30+44];
ld.shared.f32 %f38, [%r31+1408];
mad.f32 %f39, %f37, %f38, %f36;
ld.shared.f32 %f40, [%r30+48];
ld.shared.f32 %f41, [%r31+1536];
mad.f32 %f42, %f40, %f41, %f39;
ld.shared.f32 %f43, [%r30+52];
ld.shared.f32 %f44, [%r31+1664];
mad.f32 %f45, %f43, %f44, %f42;
ld.shared.f32 %f46, [%r30+56];
ld.shared.f32 %f47, [%r31+1792];
mad.f32 %f48, %f46, %f47, %f45;
ld.shared.f32 %f49, [%r30+60];
ld.shared.f32 %f50, [%r31+1920];
mad.f32 %f51, %f49, %f50, %f48;
ld.shared.f32 %f52, [%r30+64];
ld.shared.f32 %f53, [%r31+2048];
mad.f32 %f54, %f52, %f53, %f51;
ld.shared.f32 %f55, [%r30+68];
ld.shared.f32 %f56, [%r31+2176];
mad.f32 %f57, %f55, %f56, %f54;
ld.shared.f32 %f58, [%r30+72];
ld.shared.f32 %f59, [%r31+2304];
mad.f32 %f60, %f58, %f59, %f57;
ld.shared.f32 %f61, [%r30+76];
ld.shared.f32 %f62, [%r31+2432];
mad.f32 %f63, %f61, %f62, %f60;
ld.shared.f32 %f64, [%r30+80];
ld.shared.f32 %f65, [%r31+2560];
mad.f32 %f66, %f64, %f65, %f63;
ld.shared.f32 %f67, [%r30+84];
ld.shared.f32 %f68, [%r31+2688];
mad.f32 %f69, %f67, %f68, %f66;
ld.shared.f32 %f70, [%r30+88];
ld.shared.f32 %f71, [%r31+2816];
mad.f32 %f72, %f70, %f71, %f69;
ld.shared.f32 %f73, [%r30+92];
ld.shared.f32 %f74, [%r31+2944];
mad.f32 %f75, %f73, %f74, %f72;
ld.shared.f32 %f76, [%r30+96];
ld.shared.f32 %f77, [%r31+3072];
mad.f32 %f78, %f76, %f77, %f75;
ld.shared.f32 %f79, [%r30+100];
ld.shared.f32 %f80, [%r31+3200];
mad.f32 %f81, %f79, %f80, %f78;
ld.shared.f32 %f82, [%r30+104];
ld.shared.f32 %f83, [%r31+3328];
mad.f32 %f84, %f82, %f83, %f81;
ld.shared.f32 %f85, [%r30+108];
ld.shared.f32 %f86, [%r31+3456];
mad.f32 %f87, %f85, %f86, %f84;
ld.shared.f32 %f88, [%r30+112];
ld.shared.f32 %f89, [%r31+3584];
mad.f32 %f90, %f88, %f89, %f87;
ld.shared.f32 %f91, [%r30+116];
ld.shared.f32 %f92, [%r31+3712];
mad.f32 %f93, %f91, %f92, %f90;
ld.shared.f32 %f94, [%r30+120];
ld.shared.f32 %f95, [%r31+3840];
mad.f32 %f96, %f94, %f95, %f93;
ld.shared.f32 %f97, [%r30+124];
ld.shared.f32 %f98, [%r31+3968];
mad.f32 %f1, %f97, %f98, %f96;
.loc 16 97 0
bar.sync 0;
.loc 16 66 0
add.u32 %r41, %r36, %r41;
add.u32 %r7, %r7, 32;
add.u32 %r43, %r43, 128;
setp.ge.u32 %p2, %r9, %r7;
@%p2 bra $Lt_3_2818;
bra.uni $Lt_3_2306;
$Lt_3_3330:
ld.param.u32 %r12, [__cudaparm_matrixMul_bs32_64bit_wB];
mul.lo.u32 %r21, %r11, %r12;
mov.f32 %f1, 0f00000000; // 0
$Lt_3_2306:
.loc 16 103 0
ld.param.u32 %r45, [__cudaparm_matrixMul_bs32_64bit_C];
mul.lo.u32 %r46, %r12, %r3;
add.u32 %r47, %r1, %r46;
mul.lo.u32 %r48, %r47, 32;
add.u32 %r49, %r21, %r48;
add.u32 %r50, %r10, %r49;
mul.lo.u32 %r51, %r50, 4;
add.u32 %r52, %r45, %r51;
st.global.f32 [%r52+0], %f1;
.loc 16 122 0
exit;
$LDWend_matrixMul_bs32_64bit:
} // matrixMul_bs32_64bit

View File

@@ -0,0 +1,737 @@
.version 1.4
.target sm_20, map_f64_to_f32
// compiled with C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\\bin/../open64/lib//be.exe
// nvopencc 4.0 built on 2011-02-21
//-----------------------------------------------------------
// Compiling C:/Users/EYOUNG~1.COM/AppData/Local/Temp/tmpxft_00000c2c_00000000-11_matrixMul_kernel.cpp3.i (C:/Users/EYOUNG~1.COM/AppData/Local/Temp/ccBI#.a04524)
//-----------------------------------------------------------
//-----------------------------------------------------------
// Options:
//-----------------------------------------------------------
// Target:ptx, ISA:sm_20, Endian:little, Pointer Size:64
// -O3 (Optimization level)
// -g0 (Debug level)
// -m2 (Report advisories)
//-----------------------------------------------------------
.shared .align 4 .b8 __cuda_local_var_87382_38_non_const_As__6[1024];
.shared .align 4 .b8 __cuda_local_var_87386_38_non_const_Bs__7[1024];
.entry matrixMul_bs16_32bit (
.param .u64 __cudaparm_matrixMul_bs16_32bit_C,
.param .u64 __cudaparm_matrixMul_bs16_32bit_A,
.param .u64 __cudaparm_matrixMul_bs16_32bit_B,
.param .s32 __cudaparm_matrixMul_bs16_32bit_wA,
.param .s32 __cudaparm_matrixMul_bs16_32bit_wB)
{
.reg .u32 %r<34>;
.reg .u64 %rd<29>;
.reg .f32 %f<52>;
.reg .pred %p<4>;
.loc 16 107 0
$LDWbegin_matrixMul_bs16_32bit:
.loc 16 66 0
cvt.s32.u16 %r1, %ctaid.x;
mul24.lo.s32 %r2, %r1, 16;
cvt.s32.u16 %r3, %ctaid.y;
ld.param.s32 %r4, [__cudaparm_matrixMul_bs16_32bit_wA];
mul.lo.s32 %r5, %r3, %r4;
mul.lo.s32 %r6, %r5, 16;
add.s32 %r7, %r6, %r4;
sub.s32 %r8, %r7, 1;
cvt.s32.u16 %r9, %tid.x;
cvt.s32.u16 %r10, %tid.y;
ld.param.s32 %r11, [__cudaparm_matrixMul_bs16_32bit_wB];
setp.lt.s32 %p1, %r8, %r6;
@%p1 bra $Lt_0_3330;
mov.u64 %rd1, __cuda_local_var_87386_38_non_const_Bs__7;
mov.u64 %rd2, __cuda_local_var_87382_38_non_const_As__6;
ld.param.s32 %r4, [__cudaparm_matrixMul_bs16_32bit_wA];
add.s32 %r12, %r4, 15;
shr.s32 %r13, %r12, 31;
mov.s32 %r14, 15;
and.b32 %r15, %r13, %r14;
add.s32 %r16, %r15, %r12;
shr.s32 %r17, %r16, 4;
ld.param.s32 %r11, [__cudaparm_matrixMul_bs16_32bit_wB];
mul.lo.s32 %r18, %r10, %r11;
mul.lo.s32 %r19, %r10, %r4;
cvt.s64.s32 %rd3, %r9;
cvt.s64.s32 %rd4, %r10;
add.s32 %r20, %r19, %r6;
add.s32 %r21, %r9, %r20;
mul.wide.s32 %rd5, %r9, 4;
add.u64 %rd6, %rd1, %rd5;
mul.wide.s32 %rd7, %r10, 64;
add.u64 %rd8, %rd2, %rd7;
mul.wide.s32 %rd9, %r10, 16;
add.u64 %rd10, %rd3, %rd9;
mul.lo.u64 %rd11, %rd10, 4;
add.s32 %r22, %r19, %r8;
mul.lo.s32 %r23, %r11, 16;
cvt.s64.s32 %rd12, %r23;
mul.wide.s32 %rd13, %r23, 4;
add.u64 %rd14, %rd11, %rd2;
add.u64 %rd15, %rd11, %rd1;
add.s32 %r24, %r22, %r9;
ld.param.u64 %rd16, [__cudaparm_matrixMul_bs16_32bit_B];
add.s32 %r25, %r18, %r2;
add.s32 %r26, %r9, %r25;
cvt.s64.s32 %rd17, %r26;
mul.wide.s32 %rd18, %r26, 4;
add.u64 %rd19, %rd16, %rd18;
ld.param.u64 %rd20, [__cudaparm_matrixMul_bs16_32bit_A];
cvt.s64.s32 %rd21, %r21;
mul.wide.s32 %rd22, %r21, 4;
add.u64 %rd23, %rd20, %rd22;
mov.f32 %f1, 0f00000000; // 0
mov.s32 %r27, %r17;
$Lt_0_2818:
//<loop> Loop body line 66, nesting depth: 1, estimated iterations: unknown
.loc 16 81 0
ld.global.f32 %f2, [%rd23+0];
st.shared.f32 [%rd14+0], %f2;
.loc 16 82 0
ld.global.f32 %f3, [%rd19+0];
st.shared.f32 [%rd15+0], %f3;
.loc 16 85 0
bar.sync 0;
.loc 16 92 0
ld.shared.f32 %f4, [%rd8+0];
ld.shared.f32 %f5, [%rd6+0];
mad.f32 %f6, %f4, %f5, %f1;
ld.shared.f32 %f7, [%rd8+4];
ld.shared.f32 %f8, [%rd6+64];
mad.f32 %f9, %f7, %f8, %f6;
ld.shared.f32 %f10, [%rd8+8];
ld.shared.f32 %f11, [%rd6+128];
mad.f32 %f12, %f10, %f11, %f9;
ld.shared.f32 %f13, [%rd8+12];
ld.shared.f32 %f14, [%rd6+192];
mad.f32 %f15, %f13, %f14, %f12;
ld.shared.f32 %f16, [%rd8+16];
ld.shared.f32 %f17, [%rd6+256];
mad.f32 %f18, %f16, %f17, %f15;
ld.shared.f32 %f19, [%rd8+20];
ld.shared.f32 %f20, [%rd6+320];
mad.f32 %f21, %f19, %f20, %f18;
ld.shared.f32 %f22, [%rd8+24];
ld.shared.f32 %f23, [%rd6+384];
mad.f32 %f24, %f22, %f23, %f21;
ld.shared.f32 %f25, [%rd8+28];
ld.shared.f32 %f26, [%rd6+448];
mad.f32 %f27, %f25, %f26, %f24;
ld.shared.f32 %f28, [%rd8+32];
ld.shared.f32 %f29, [%rd6+512];
mad.f32 %f30, %f28, %f29, %f27;
ld.shared.f32 %f31, [%rd8+36];
ld.shared.f32 %f32, [%rd6+576];
mad.f32 %f33, %f31, %f32, %f30;
ld.shared.f32 %f34, [%rd8+40];
ld.shared.f32 %f35, [%rd6+640];
mad.f32 %f36, %f34, %f35, %f33;
ld.shared.f32 %f37, [%rd8+44];
ld.shared.f32 %f38, [%rd6+704];
mad.f32 %f39, %f37, %f38, %f36;
ld.shared.f32 %f40, [%rd8+48];
ld.shared.f32 %f41, [%rd6+768];
mad.f32 %f42, %f40, %f41, %f39;
ld.shared.f32 %f43, [%rd8+52];
ld.shared.f32 %f44, [%rd6+832];
mad.f32 %f45, %f43, %f44, %f42;
ld.shared.f32 %f46, [%rd8+56];
ld.shared.f32 %f47, [%rd6+896];
mad.f32 %f48, %f46, %f47, %f45;
ld.shared.f32 %f49, [%rd8+60];
ld.shared.f32 %f50, [%rd6+960];
mad.f32 %f1, %f49, %f50, %f48;
.loc 16 97 0
bar.sync 0;
.loc 16 66 0
add.u64 %rd19, %rd13, %rd19;
add.s32 %r21, %r21, 16;
add.u64 %rd23, %rd23, 64;
setp.le.s32 %p2, %r21, %r24;
@%p2 bra $Lt_0_2818;
bra.uni $Lt_0_2306;
$Lt_0_3330:
ld.param.s32 %r11, [__cudaparm_matrixMul_bs16_32bit_wB];
mul.lo.s32 %r18, %r10, %r11;
mov.f32 %f1, 0f00000000; // 0
$Lt_0_2306:
.loc 16 103 0
ld.param.u64 %rd24, [__cudaparm_matrixMul_bs16_32bit_C];
mul.lo.s32 %r28, %r11, %r3;
add.s32 %r29, %r1, %r28;
mul.lo.s32 %r30, %r29, 16;
add.s32 %r31, %r18, %r30;
add.s32 %r32, %r9, %r31;
cvt.s64.s32 %rd25, %r32;
mul.wide.s32 %rd26, %r32, 4;
add.u64 %rd27, %rd24, %rd26;
st.global.f32 [%rd27+0], %f1;
.loc 16 110 0
exit;
$LDWend_matrixMul_bs16_32bit:
} // matrixMul_bs16_32bit
.shared .align 4 .b8 __cuda_local_var_87382_38_non_const_As__4[1024];
.shared .align 4 .b8 __cuda_local_var_87386_38_non_const_Bs__5[1024];
.entry matrixMul_bs16_64bit (
.param .u64 __cudaparm_matrixMul_bs16_64bit_C,
.param .u64 __cudaparm_matrixMul_bs16_64bit_A,
.param .u64 __cudaparm_matrixMul_bs16_64bit_B,
.param .u64 __cudaparm_matrixMul_bs16_64bit_wA,
.param .u64 __cudaparm_matrixMul_bs16_64bit_wB)
{
.reg .u64 %rd<53>;
.reg .f32 %f<52>;
.reg .pred %p<4>;
.loc 16 111 0
$LDWbegin_matrixMul_bs16_64bit:
.loc 16 66 0
cvt.u64.u16 %rd1, %ctaid.x;
mul.lo.u64 %rd2, %rd1, 16;
cvt.u64.u16 %rd3, %ctaid.y;
ld.param.u64 %rd4, [__cudaparm_matrixMul_bs16_64bit_wA];
mul.lo.u64 %rd5, %rd3, %rd4;
mul.lo.u64 %rd6, %rd5, 16;
mov.s64 %rd7, %rd6;
add.u64 %rd8, %rd6, %rd4;
sub.u64 %rd9, %rd8, 1;
cvt.u64.u16 %rd10, %tid.x;
cvt.u64.u16 %rd11, %tid.y;
ld.param.u64 %rd12, [__cudaparm_matrixMul_bs16_64bit_wB];
setp.lt.u64 %p1, %rd9, %rd6;
@%p1 bra $Lt_1_3330;
mov.u64 %rd13, __cuda_local_var_87386_38_non_const_Bs__5;
mov.u64 %rd14, __cuda_local_var_87382_38_non_const_As__4;
ld.param.u64 %rd4, [__cudaparm_matrixMul_bs16_64bit_wA];
add.u64 %rd15, %rd4, 15;
shr.s64 %rd16, %rd15, 63;
mov.s64 %rd17, 15;
and.b64 %rd18, %rd16, %rd17;
add.s64 %rd19, %rd18, %rd15;
shr.s64 %rd20, %rd19, 4;
ld.param.u64 %rd12, [__cudaparm_matrixMul_bs16_64bit_wB];
mul.lo.u64 %rd21, %rd11, %rd12;
mul.lo.u64 %rd22, %rd11, 64;
add.u64 %rd23, %rd14, %rd22;
mul.lo.u64 %rd24, %rd10, 4;
add.u64 %rd25, %rd13, %rd24;
mul.lo.u64 %rd26, %rd11, 16;
add.u64 %rd27, %rd10, %rd26;
mul.lo.u64 %rd28, %rd27, 4;
mul.lo.u64 %rd29, %rd12, 64;
add.u64 %rd30, %rd28, %rd14;
add.u64 %rd31, %rd28, %rd13;
ld.param.u64 %rd32, [__cudaparm_matrixMul_bs16_64bit_B];
add.u64 %rd33, %rd21, %rd2;
add.u64 %rd34, %rd10, %rd33;
mul.lo.u64 %rd35, %rd34, 4;
add.u64 %rd36, %rd32, %rd35;
ld.param.u64 %rd37, [__cudaparm_matrixMul_bs16_64bit_A];
mul.lo.u64 %rd38, %rd11, %rd4;
add.u64 %rd39, %rd6, %rd38;
add.u64 %rd40, %rd10, %rd39;
mul.lo.u64 %rd41, %rd40, 4;
add.u64 %rd42, %rd37, %rd41;
mov.f32 %f1, 0f00000000; // 0
mov.s64 %rd43, %rd20;
$Lt_1_2818:
//<loop> Loop body line 66, nesting depth: 1, estimated iterations: unknown
.loc 16 81 0
ld.global.f32 %f2, [%rd42+0];
st.shared.f32 [%rd30+0], %f2;
.loc 16 82 0
ld.global.f32 %f3, [%rd36+0];
st.shared.f32 [%rd31+0], %f3;
.loc 16 85 0
bar.sync 0;
.loc 16 92 0
ld.shared.f32 %f4, [%rd23+0];
ld.shared.f32 %f5, [%rd25+0];
mad.f32 %f6, %f4, %f5, %f1;
ld.shared.f32 %f7, [%rd23+4];
ld.shared.f32 %f8, [%rd25+64];
mad.f32 %f9, %f7, %f8, %f6;
ld.shared.f32 %f10, [%rd23+8];
ld.shared.f32 %f11, [%rd25+128];
mad.f32 %f12, %f10, %f11, %f9;
ld.shared.f32 %f13, [%rd23+12];
ld.shared.f32 %f14, [%rd25+192];
mad.f32 %f15, %f13, %f14, %f12;
ld.shared.f32 %f16, [%rd23+16];
ld.shared.f32 %f17, [%rd25+256];
mad.f32 %f18, %f16, %f17, %f15;
ld.shared.f32 %f19, [%rd23+20];
ld.shared.f32 %f20, [%rd25+320];
mad.f32 %f21, %f19, %f20, %f18;
ld.shared.f32 %f22, [%rd23+24];
ld.shared.f32 %f23, [%rd25+384];
mad.f32 %f24, %f22, %f23, %f21;
ld.shared.f32 %f25, [%rd23+28];
ld.shared.f32 %f26, [%rd25+448];
mad.f32 %f27, %f25, %f26, %f24;
ld.shared.f32 %f28, [%rd23+32];
ld.shared.f32 %f29, [%rd25+512];
mad.f32 %f30, %f28, %f29, %f27;
ld.shared.f32 %f31, [%rd23+36];
ld.shared.f32 %f32, [%rd25+576];
mad.f32 %f33, %f31, %f32, %f30;
ld.shared.f32 %f34, [%rd23+40];
ld.shared.f32 %f35, [%rd25+640];
mad.f32 %f36, %f34, %f35, %f33;
ld.shared.f32 %f37, [%rd23+44];
ld.shared.f32 %f38, [%rd25+704];
mad.f32 %f39, %f37, %f38, %f36;
ld.shared.f32 %f40, [%rd23+48];
ld.shared.f32 %f41, [%rd25+768];
mad.f32 %f42, %f40, %f41, %f39;
ld.shared.f32 %f43, [%rd23+52];
ld.shared.f32 %f44, [%rd25+832];
mad.f32 %f45, %f43, %f44, %f42;
ld.shared.f32 %f46, [%rd23+56];
ld.shared.f32 %f47, [%rd25+896];
mad.f32 %f48, %f46, %f47, %f45;
ld.shared.f32 %f49, [%rd23+60];
ld.shared.f32 %f50, [%rd25+960];
mad.f32 %f1, %f49, %f50, %f48;
.loc 16 97 0
bar.sync 0;
.loc 16 66 0
add.u64 %rd36, %rd29, %rd36;
add.u64 %rd7, %rd7, 16;
add.u64 %rd42, %rd42, 64;
setp.ge.u64 %p2, %rd9, %rd7;
@%p2 bra $Lt_1_2818;
bra.uni $Lt_1_2306;
$Lt_1_3330:
ld.param.u64 %rd12, [__cudaparm_matrixMul_bs16_64bit_wB];
mul.lo.u64 %rd21, %rd11, %rd12;
mov.f32 %f1, 0f00000000; // 0
$Lt_1_2306:
.loc 16 103 0
ld.param.u64 %rd44, [__cudaparm_matrixMul_bs16_64bit_C];
mul.lo.u64 %rd45, %rd12, %rd3;
add.u64 %rd46, %rd1, %rd45;
mul.lo.u64 %rd47, %rd46, 16;
add.u64 %rd48, %rd21, %rd47;
add.u64 %rd49, %rd10, %rd48;
mul.lo.u64 %rd50, %rd49, 4;
add.u64 %rd51, %rd44, %rd50;
st.global.f32 [%rd51+0], %f1;
.loc 16 114 0
exit;
$LDWend_matrixMul_bs16_64bit:
} // matrixMul_bs16_64bit
.shared .align 4 .b8 __cuda_local_var_87382_38_non_const_As__2[4096];
.shared .align 4 .b8 __cuda_local_var_87386_38_non_const_Bs__3[4096];
.entry matrixMul_bs32_32bit (
.param .u64 __cudaparm_matrixMul_bs32_32bit_C,
.param .u64 __cudaparm_matrixMul_bs32_32bit_A,
.param .u64 __cudaparm_matrixMul_bs32_32bit_B,
.param .s32 __cudaparm_matrixMul_bs32_32bit_wA,
.param .s32 __cudaparm_matrixMul_bs32_32bit_wB)
{
.reg .u32 %r<34>;
.reg .u64 %rd<29>;
.reg .f32 %f<100>;
.reg .pred %p<4>;
.loc 16 115 0
$LDWbegin_matrixMul_bs32_32bit:
.loc 16 66 0
cvt.s32.u16 %r1, %ctaid.x;
mul24.lo.s32 %r2, %r1, 32;
cvt.s32.u16 %r3, %ctaid.y;
ld.param.s32 %r4, [__cudaparm_matrixMul_bs32_32bit_wA];
mul.lo.s32 %r5, %r3, %r4;
mul.lo.s32 %r6, %r5, 32;
add.s32 %r7, %r6, %r4;
sub.s32 %r8, %r7, 1;
cvt.s32.u16 %r9, %tid.x;
cvt.s32.u16 %r10, %tid.y;
ld.param.s32 %r11, [__cudaparm_matrixMul_bs32_32bit_wB];
setp.lt.s32 %p1, %r8, %r6;
@%p1 bra $Lt_2_3330;
mov.u64 %rd1, __cuda_local_var_87386_38_non_const_Bs__3;
mov.u64 %rd2, __cuda_local_var_87382_38_non_const_As__2;
ld.param.s32 %r4, [__cudaparm_matrixMul_bs32_32bit_wA];
add.s32 %r12, %r4, 31;
shr.s32 %r13, %r12, 31;
mov.s32 %r14, 31;
and.b32 %r15, %r13, %r14;
add.s32 %r16, %r15, %r12;
shr.s32 %r17, %r16, 5;
ld.param.s32 %r11, [__cudaparm_matrixMul_bs32_32bit_wB];
mul.lo.s32 %r18, %r10, %r11;
mul.lo.s32 %r19, %r10, %r4;
cvt.s64.s32 %rd3, %r9;
cvt.s64.s32 %rd4, %r10;
add.s32 %r20, %r19, %r6;
add.s32 %r21, %r9, %r20;
mul.wide.s32 %rd5, %r9, 4;
add.u64 %rd6, %rd1, %rd5;
mul.wide.s32 %rd7, %r10, 128;
add.u64 %rd8, %rd2, %rd7;
mul.wide.s32 %rd9, %r10, 32;
add.u64 %rd10, %rd3, %rd9;
mul.lo.u64 %rd11, %rd10, 4;
add.s32 %r22, %r19, %r8;
mul.lo.s32 %r23, %r11, 32;
cvt.s64.s32 %rd12, %r23;
mul.wide.s32 %rd13, %r23, 4;
add.u64 %rd14, %rd11, %rd2;
add.u64 %rd15, %rd11, %rd1;
add.s32 %r24, %r22, %r9;
ld.param.u64 %rd16, [__cudaparm_matrixMul_bs32_32bit_B];
add.s32 %r25, %r18, %r2;
add.s32 %r26, %r9, %r25;
cvt.s64.s32 %rd17, %r26;
mul.wide.s32 %rd18, %r26, 4;
add.u64 %rd19, %rd16, %rd18;
ld.param.u64 %rd20, [__cudaparm_matrixMul_bs32_32bit_A];
cvt.s64.s32 %rd21, %r21;
mul.wide.s32 %rd22, %r21, 4;
add.u64 %rd23, %rd20, %rd22;
mov.f32 %f1, 0f00000000; // 0
mov.s32 %r27, %r17;
$Lt_2_2818:
//<loop> Loop body line 66, nesting depth: 1, estimated iterations: unknown
.loc 16 81 0
ld.global.f32 %f2, [%rd23+0];
st.shared.f32 [%rd14+0], %f2;
.loc 16 82 0
ld.global.f32 %f3, [%rd19+0];
st.shared.f32 [%rd15+0], %f3;
.loc 16 85 0
bar.sync 0;
.loc 16 92 0
ld.shared.f32 %f4, [%rd8+0];
ld.shared.f32 %f5, [%rd6+0];
mad.f32 %f6, %f4, %f5, %f1;
ld.shared.f32 %f7, [%rd8+4];
ld.shared.f32 %f8, [%rd6+128];
mad.f32 %f9, %f7, %f8, %f6;
ld.shared.f32 %f10, [%rd8+8];
ld.shared.f32 %f11, [%rd6+256];
mad.f32 %f12, %f10, %f11, %f9;
ld.shared.f32 %f13, [%rd8+12];
ld.shared.f32 %f14, [%rd6+384];
mad.f32 %f15, %f13, %f14, %f12;
ld.shared.f32 %f16, [%rd8+16];
ld.shared.f32 %f17, [%rd6+512];
mad.f32 %f18, %f16, %f17, %f15;
ld.shared.f32 %f19, [%rd8+20];
ld.shared.f32 %f20, [%rd6+640];
mad.f32 %f21, %f19, %f20, %f18;
ld.shared.f32 %f22, [%rd8+24];
ld.shared.f32 %f23, [%rd6+768];
mad.f32 %f24, %f22, %f23, %f21;
ld.shared.f32 %f25, [%rd8+28];
ld.shared.f32 %f26, [%rd6+896];
mad.f32 %f27, %f25, %f26, %f24;
ld.shared.f32 %f28, [%rd8+32];
ld.shared.f32 %f29, [%rd6+1024];
mad.f32 %f30, %f28, %f29, %f27;
ld.shared.f32 %f31, [%rd8+36];
ld.shared.f32 %f32, [%rd6+1152];
mad.f32 %f33, %f31, %f32, %f30;
ld.shared.f32 %f34, [%rd8+40];
ld.shared.f32 %f35, [%rd6+1280];
mad.f32 %f36, %f34, %f35, %f33;
ld.shared.f32 %f37, [%rd8+44];
ld.shared.f32 %f38, [%rd6+1408];
mad.f32 %f39, %f37, %f38, %f36;
ld.shared.f32 %f40, [%rd8+48];
ld.shared.f32 %f41, [%rd6+1536];
mad.f32 %f42, %f40, %f41, %f39;
ld.shared.f32 %f43, [%rd8+52];
ld.shared.f32 %f44, [%rd6+1664];
mad.f32 %f45, %f43, %f44, %f42;
ld.shared.f32 %f46, [%rd8+56];
ld.shared.f32 %f47, [%rd6+1792];
mad.f32 %f48, %f46, %f47, %f45;
ld.shared.f32 %f49, [%rd8+60];
ld.shared.f32 %f50, [%rd6+1920];
mad.f32 %f51, %f49, %f50, %f48;
ld.shared.f32 %f52, [%rd8+64];
ld.shared.f32 %f53, [%rd6+2048];
mad.f32 %f54, %f52, %f53, %f51;
ld.shared.f32 %f55, [%rd8+68];
ld.shared.f32 %f56, [%rd6+2176];
mad.f32 %f57, %f55, %f56, %f54;
ld.shared.f32 %f58, [%rd8+72];
ld.shared.f32 %f59, [%rd6+2304];
mad.f32 %f60, %f58, %f59, %f57;
ld.shared.f32 %f61, [%rd8+76];
ld.shared.f32 %f62, [%rd6+2432];
mad.f32 %f63, %f61, %f62, %f60;
ld.shared.f32 %f64, [%rd8+80];
ld.shared.f32 %f65, [%rd6+2560];
mad.f32 %f66, %f64, %f65, %f63;
ld.shared.f32 %f67, [%rd8+84];
ld.shared.f32 %f68, [%rd6+2688];
mad.f32 %f69, %f67, %f68, %f66;
ld.shared.f32 %f70, [%rd8+88];
ld.shared.f32 %f71, [%rd6+2816];
mad.f32 %f72, %f70, %f71, %f69;
ld.shared.f32 %f73, [%rd8+92];
ld.shared.f32 %f74, [%rd6+2944];
mad.f32 %f75, %f73, %f74, %f72;
ld.shared.f32 %f76, [%rd8+96];
ld.shared.f32 %f77, [%rd6+3072];
mad.f32 %f78, %f76, %f77, %f75;
ld.shared.f32 %f79, [%rd8+100];
ld.shared.f32 %f80, [%rd6+3200];
mad.f32 %f81, %f79, %f80, %f78;
ld.shared.f32 %f82, [%rd8+104];
ld.shared.f32 %f83, [%rd6+3328];
mad.f32 %f84, %f82, %f83, %f81;
ld.shared.f32 %f85, [%rd8+108];
ld.shared.f32 %f86, [%rd6+3456];
mad.f32 %f87, %f85, %f86, %f84;
ld.shared.f32 %f88, [%rd8+112];
ld.shared.f32 %f89, [%rd6+3584];
mad.f32 %f90, %f88, %f89, %f87;
ld.shared.f32 %f91, [%rd8+116];
ld.shared.f32 %f92, [%rd6+3712];
mad.f32 %f93, %f91, %f92, %f90;
ld.shared.f32 %f94, [%rd8+120];
ld.shared.f32 %f95, [%rd6+3840];
mad.f32 %f96, %f94, %f95, %f93;
ld.shared.f32 %f97, [%rd8+124];
ld.shared.f32 %f98, [%rd6+3968];
mad.f32 %f1, %f97, %f98, %f96;
.loc 16 97 0
bar.sync 0;
.loc 16 66 0
add.u64 %rd19, %rd13, %rd19;
add.s32 %r21, %r21, 32;
add.u64 %rd23, %rd23, 128;
setp.le.s32 %p2, %r21, %r24;
@%p2 bra $Lt_2_2818;
bra.uni $Lt_2_2306;
$Lt_2_3330:
ld.param.s32 %r11, [__cudaparm_matrixMul_bs32_32bit_wB];
mul.lo.s32 %r18, %r10, %r11;
mov.f32 %f1, 0f00000000; // 0
$Lt_2_2306:
.loc 16 103 0
ld.param.u64 %rd24, [__cudaparm_matrixMul_bs32_32bit_C];
mul.lo.s32 %r28, %r11, %r3;
add.s32 %r29, %r1, %r28;
mul.lo.s32 %r30, %r29, 32;
add.s32 %r31, %r18, %r30;
add.s32 %r32, %r9, %r31;
cvt.s64.s32 %rd25, %r32;
mul.wide.s32 %rd26, %r32, 4;
add.u64 %rd27, %rd24, %rd26;
st.global.f32 [%rd27+0], %f1;
.loc 16 118 0
exit;
$LDWend_matrixMul_bs32_32bit:
} // matrixMul_bs32_32bit
.shared .align 4 .b8 __cuda_local_var_87382_38_non_const_As__0[4096];
.shared .align 4 .b8 __cuda_local_var_87386_38_non_const_Bs__1[4096];
.entry matrixMul_bs32_64bit (
.param .u64 __cudaparm_matrixMul_bs32_64bit_C,
.param .u64 __cudaparm_matrixMul_bs32_64bit_A,
.param .u64 __cudaparm_matrixMul_bs32_64bit_B,
.param .u64 __cudaparm_matrixMul_bs32_64bit_wA,
.param .u64 __cudaparm_matrixMul_bs32_64bit_wB)
{
.reg .u64 %rd<53>;
.reg .f32 %f<100>;
.reg .pred %p<4>;
.loc 16 119 0
$LDWbegin_matrixMul_bs32_64bit:
.loc 16 66 0
cvt.u64.u16 %rd1, %ctaid.x;
mul.lo.u64 %rd2, %rd1, 32;
cvt.u64.u16 %rd3, %ctaid.y;
ld.param.u64 %rd4, [__cudaparm_matrixMul_bs32_64bit_wA];
mul.lo.u64 %rd5, %rd3, %rd4;
mul.lo.u64 %rd6, %rd5, 32;
mov.s64 %rd7, %rd6;
add.u64 %rd8, %rd6, %rd4;
sub.u64 %rd9, %rd8, 1;
cvt.u64.u16 %rd10, %tid.x;
cvt.u64.u16 %rd11, %tid.y;
ld.param.u64 %rd12, [__cudaparm_matrixMul_bs32_64bit_wB];
setp.lt.u64 %p1, %rd9, %rd6;
@%p1 bra $Lt_3_3330;
mov.u64 %rd13, __cuda_local_var_87386_38_non_const_Bs__1;
mov.u64 %rd14, __cuda_local_var_87382_38_non_const_As__0;
ld.param.u64 %rd4, [__cudaparm_matrixMul_bs32_64bit_wA];
add.u64 %rd15, %rd4, 31;
shr.s64 %rd16, %rd15, 63;
mov.s64 %rd17, 31;
and.b64 %rd18, %rd16, %rd17;
add.s64 %rd19, %rd18, %rd15;
shr.s64 %rd20, %rd19, 5;
ld.param.u64 %rd12, [__cudaparm_matrixMul_bs32_64bit_wB];
mul.lo.u64 %rd21, %rd11, %rd12;
mul.lo.u64 %rd22, %rd11, 128;
add.u64 %rd23, %rd14, %rd22;
mul.lo.u64 %rd24, %rd10, 4;
add.u64 %rd25, %rd13, %rd24;
mul.lo.u64 %rd26, %rd11, 32;
add.u64 %rd27, %rd10, %rd26;
mul.lo.u64 %rd28, %rd27, 4;
mul.lo.u64 %rd29, %rd12, 128;
add.u64 %rd30, %rd28, %rd14;
add.u64 %rd31, %rd28, %rd13;
ld.param.u64 %rd32, [__cudaparm_matrixMul_bs32_64bit_B];
add.u64 %rd33, %rd21, %rd2;
add.u64 %rd34, %rd10, %rd33;
mul.lo.u64 %rd35, %rd34, 4;
add.u64 %rd36, %rd32, %rd35;
ld.param.u64 %rd37, [__cudaparm_matrixMul_bs32_64bit_A];
mul.lo.u64 %rd38, %rd11, %rd4;
add.u64 %rd39, %rd6, %rd38;
add.u64 %rd40, %rd10, %rd39;
mul.lo.u64 %rd41, %rd40, 4;
add.u64 %rd42, %rd37, %rd41;
mov.f32 %f1, 0f00000000; // 0
mov.s64 %rd43, %rd20;
$Lt_3_2818:
//<loop> Loop body line 66, nesting depth: 1, estimated iterations: unknown
.loc 16 81 0
ld.global.f32 %f2, [%rd42+0];
st.shared.f32 [%rd30+0], %f2;
.loc 16 82 0
ld.global.f32 %f3, [%rd36+0];
st.shared.f32 [%rd31+0], %f3;
.loc 16 85 0
bar.sync 0;
.loc 16 92 0
ld.shared.f32 %f4, [%rd23+0];
ld.shared.f32 %f5, [%rd25+0];
mad.f32 %f6, %f4, %f5, %f1;
ld.shared.f32 %f7, [%rd23+4];
ld.shared.f32 %f8, [%rd25+128];
mad.f32 %f9, %f7, %f8, %f6;
ld.shared.f32 %f10, [%rd23+8];
ld.shared.f32 %f11, [%rd25+256];
mad.f32 %f12, %f10, %f11, %f9;
ld.shared.f32 %f13, [%rd23+12];
ld.shared.f32 %f14, [%rd25+384];
mad.f32 %f15, %f13, %f14, %f12;
ld.shared.f32 %f16, [%rd23+16];
ld.shared.f32 %f17, [%rd25+512];
mad.f32 %f18, %f16, %f17, %f15;
ld.shared.f32 %f19, [%rd23+20];
ld.shared.f32 %f20, [%rd25+640];
mad.f32 %f21, %f19, %f20, %f18;
ld.shared.f32 %f22, [%rd23+24];
ld.shared.f32 %f23, [%rd25+768];
mad.f32 %f24, %f22, %f23, %f21;
ld.shared.f32 %f25, [%rd23+28];
ld.shared.f32 %f26, [%rd25+896];
mad.f32 %f27, %f25, %f26, %f24;
ld.shared.f32 %f28, [%rd23+32];
ld.shared.f32 %f29, [%rd25+1024];
mad.f32 %f30, %f28, %f29, %f27;
ld.shared.f32 %f31, [%rd23+36];
ld.shared.f32 %f32, [%rd25+1152];
mad.f32 %f33, %f31, %f32, %f30;
ld.shared.f32 %f34, [%rd23+40];
ld.shared.f32 %f35, [%rd25+1280];
mad.f32 %f36, %f34, %f35, %f33;
ld.shared.f32 %f37, [%rd23+44];
ld.shared.f32 %f38, [%rd25+1408];
mad.f32 %f39, %f37, %f38, %f36;
ld.shared.f32 %f40, [%rd23+48];
ld.shared.f32 %f41, [%rd25+1536];
mad.f32 %f42, %f40, %f41, %f39;
ld.shared.f32 %f43, [%rd23+52];
ld.shared.f32 %f44, [%rd25+1664];
mad.f32 %f45, %f43, %f44, %f42;
ld.shared.f32 %f46, [%rd23+56];
ld.shared.f32 %f47, [%rd25+1792];
mad.f32 %f48, %f46, %f47, %f45;
ld.shared.f32 %f49, [%rd23+60];
ld.shared.f32 %f50, [%rd25+1920];
mad.f32 %f51, %f49, %f50, %f48;
ld.shared.f32 %f52, [%rd23+64];
ld.shared.f32 %f53, [%rd25+2048];
mad.f32 %f54, %f52, %f53, %f51;
ld.shared.f32 %f55, [%rd23+68];
ld.shared.f32 %f56, [%rd25+2176];
mad.f32 %f57, %f55, %f56, %f54;
ld.shared.f32 %f58, [%rd23+72];
ld.shared.f32 %f59, [%rd25+2304];
mad.f32 %f60, %f58, %f59, %f57;
ld.shared.f32 %f61, [%rd23+76];
ld.shared.f32 %f62, [%rd25+2432];
mad.f32 %f63, %f61, %f62, %f60;
ld.shared.f32 %f64, [%rd23+80];
ld.shared.f32 %f65, [%rd25+2560];
mad.f32 %f66, %f64, %f65, %f63;
ld.shared.f32 %f67, [%rd23+84];
ld.shared.f32 %f68, [%rd25+2688];
mad.f32 %f69, %f67, %f68, %f66;
ld.shared.f32 %f70, [%rd23+88];
ld.shared.f32 %f71, [%rd25+2816];
mad.f32 %f72, %f70, %f71, %f69;
ld.shared.f32 %f73, [%rd23+92];
ld.shared.f32 %f74, [%rd25+2944];
mad.f32 %f75, %f73, %f74, %f72;
ld.shared.f32 %f76, [%rd23+96];
ld.shared.f32 %f77, [%rd25+3072];
mad.f32 %f78, %f76, %f77, %f75;
ld.shared.f32 %f79, [%rd23+100];
ld.shared.f32 %f80, [%rd25+3200];
mad.f32 %f81, %f79, %f80, %f78;
ld.shared.f32 %f82, [%rd23+104];
ld.shared.f32 %f83, [%rd25+3328];
mad.f32 %f84, %f82, %f83, %f81;
ld.shared.f32 %f85, [%rd23+108];
ld.shared.f32 %f86, [%rd25+3456];
mad.f32 %f87, %f85, %f86, %f84;
ld.shared.f32 %f88, [%rd23+112];
ld.shared.f32 %f89, [%rd25+3584];
mad.f32 %f90, %f88, %f89, %f87;
ld.shared.f32 %f91, [%rd23+116];
ld.shared.f32 %f92, [%rd25+3712];
mad.f32 %f93, %f91, %f92, %f90;
ld.shared.f32 %f94, [%rd23+120];
ld.shared.f32 %f95, [%rd25+3840];
mad.f32 %f96, %f94, %f95, %f93;
ld.shared.f32 %f97, [%rd23+124];
ld.shared.f32 %f98, [%rd25+3968];
mad.f32 %f1, %f97, %f98, %f96;
.loc 16 97 0
bar.sync 0;
.loc 16 66 0
add.u64 %rd36, %rd29, %rd36;
add.u64 %rd7, %rd7, 32;
add.u64 %rd42, %rd42, 128;
setp.ge.u64 %p2, %rd9, %rd7;
@%p2 bra $Lt_3_2818;
bra.uni $Lt_3_2306;
$Lt_3_3330:
ld.param.u64 %rd12, [__cudaparm_matrixMul_bs32_64bit_wB];
mul.lo.u64 %rd21, %rd11, %rd12;
mov.f32 %f1, 0f00000000; // 0
$Lt_3_2306:
.loc 16 103 0
ld.param.u64 %rd44, [__cudaparm_matrixMul_bs32_64bit_C];
mul.lo.u64 %rd45, %rd12, %rd3;
add.u64 %rd46, %rd1, %rd45;
mul.lo.u64 %rd47, %rd46, 32;
add.u64 %rd48, %rd21, %rd47;
add.u64 %rd49, %rd10, %rd48;
mul.lo.u64 %rd50, %rd49, 4;
add.u64 %rd51, %rd44, %rd50;
st.global.f32 [%rd51+0], %f1;
.loc 16 122 0
exit;
$LDWend_matrixMul_bs32_64bit:
} // matrixMul_bs32_64bit

View File

@@ -0,0 +1,91 @@
#!/usr/bin/env python
from string import *
import os, getopt, sys, platform
g_Header = '''/* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NVIDIA CORPORATION nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
////////////////////////////////////////////////////////////////////////////////
// This file is auto-generated, do not edit
////////////////////////////////////////////////////////////////////////////////
'''
def Usage():
print("Usage: ptx2c.py in out")
print("Description: performs embedding in.cubin or in.ptx file into out.c and out.h files as character array")
sys.exit(0)
def FormatCharHex(d):
s = hex(ord(d))
if len(s) == 3:
s = "0x0" + s[2]
return s
args = sys.argv[1:]
if not(len(sys.argv[1:]) == 2):
Usage()
out_h = args[1] + "_ptxdump.h"
out_c = args[1] + "_ptxdump.c"
h_in = open(args[0], 'r')
source_bytes = h_in.read()
source_bytes_len = len(source_bytes)
h_out_c = open(out_c, 'w')
h_out_c.writelines(g_Header)
h_out_c.writelines("#include \"" + out_h + "\"\n\n")
h_out_c.writelines("unsigned char " + args[1] + "_ptxdump[" + str(source_bytes_len+1) + "] = {\n")
h_out_h = open(out_h, 'w')
macro_h = "__" + args[1] + "_ptxdump_h__"
h_out_h.writelines(g_Header)
h_out_h.writelines("#ifndef " + macro_h + "\n")
h_out_h.writelines("#define " + macro_h + "\n\n")
h_out_h.writelines('#if defined __cplusplus\nextern "C" {\n#endif\n\n')
h_out_h.writelines("extern unsigned char " + args[1] + "_ptxdump[" + str(source_bytes_len+1) + "];\n\n")
h_out_h.writelines("#if defined __cplusplus\n}\n#endif\n\n")
h_out_h.writelines("#endif //" + macro_h + "\n")
newlinecnt = 0
for i in range(0, source_bytes_len):
h_out_c.write(FormatCharHex(source_bytes[i]) + ", ")
newlinecnt += 1
if newlinecnt == 16:
newlinecnt = 0
h_out_c.write("\n")
h_out_c.write("0x00\n};\n")
h_in.close()
h_out_c.close()
h_out_h.close()
print("ptx2c: CUmodule " + args[0] + " packed successfully")

View File

@@ -0,0 +1,356 @@
/**
* Copyright 1993-2017 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and related documentation outside the terms of the EULA
* is strictly prohibited.
*
*/
// Helper functions for CUDA Driver API error handling (make sure that CUDA_H is
// included in your projects)
#ifndef HELPER_CUDA_DRVAPI_H
#define HELPER_CUDA_DRVAPI_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <helper_string.h>
#ifndef MAX
#define MAX(a, b) (a > b ? a : b)
#endif
#ifndef HELPER_CUDA_DRVAPI_H
inline int ftoi(float value) {
return (value >= 0 ? static_cast<int>(value + 0.5)
: static_cast<int>(value - 0.5));
}
#endif
#ifndef EXIT_WAIVED
#define EXIT_WAIVED 2
#endif
////////////////////////////////////////////////////////////////////////////////
// These are CUDA Helper functions
// add a level of protection to the CUDA SDK samples, let's force samples to
// explicitly include CUDA.H
#ifdef __cuda_cuda_h__
// This will output the proper CUDA error strings in the event that a CUDA host
// call returns an error
#ifndef checkCudaErrors
#define checkCudaErrors(err) __checkCudaErrors(err, __FILE__, __LINE__)
// These are the inline versions for all of the SDK helper functions
inline void __checkCudaErrors(CUresult err, const char *file, const int line) {
if (CUDA_SUCCESS != err) {
const char *errorStr = NULL;
cuGetErrorString(err, &errorStr);
fprintf(stderr,
"checkCudaErrors() Driver API error = %04d \"%s\" from file <%s>, "
"line %i.\n",
err, errorStr, file, line);
exit(EXIT_FAILURE);
}
}
#endif
// This function wraps the CUDA Driver API into a template function
template <class T>
inline void getCudaAttribute(T *attribute, CUdevice_attribute device_attribute,
int device) {
checkCudaErrors(cuDeviceGetAttribute(attribute, device_attribute, device));
}
#endif
// Beginning of GPU Architecture definitions
inline int _ConvertSMVer2CoresDRV(int major, int minor) {
// Defines for GPU Architecture types (using the SM version to determine the #
// of cores per SM
typedef struct {
int SM; // 0xMm (hexidecimal notation), M = SM Major version, and m = SM
// minor version
int Cores;
} sSMtoCores;
sSMtoCores nGpuArchCoresPerSM[] = {
{0x30, 192},
{0x32, 192},
{0x35, 192},
{0x37, 192},
{0x50, 128},
{0x52, 128},
{0x53, 128},
{0x60, 64},
{0x61, 128},
{0x62, 128},
{0x70, 64},
{0x72, 64},
{0x75, 64},
{0x80, 64},
{0x86, 128},
{0x87, 128},
{-1, -1}};
int index = 0;
while (nGpuArchCoresPerSM[index].SM != -1) {
if (nGpuArchCoresPerSM[index].SM == ((major << 4) + minor)) {
return nGpuArchCoresPerSM[index].Cores;
}
index++;
}
// If we don't find the values, we default use the previous one to run
// properly
printf(
"MapSMtoCores for SM %d.%d is undefined. Default to use %d Cores/SM\n",
major, minor, nGpuArchCoresPerSM[index - 1].Cores);
return nGpuArchCoresPerSM[index - 1].Cores;
}
// end of GPU Architecture definitions
#ifdef __cuda_cuda_h__
// General GPU Device CUDA Initialization
inline int gpuDeviceInitDRV(int ARGC, const char **ARGV) {
int cuDevice = 0;
int deviceCount = 0;
checkCudaErrors(cuInit(0, __CUDA_API_VERSION));
checkCudaErrors(cuDeviceGetCount(&deviceCount));
if (deviceCount == 0) {
fprintf(stderr, "cudaDeviceInit error: no devices supporting CUDA\n");
exit(EXIT_FAILURE);
}
int dev = 0;
dev = getCmdLineArgumentInt(ARGC, (const char **)ARGV, "device=");
if (dev < 0) {
dev = 0;
}
if (dev > deviceCount - 1) {
fprintf(stderr, "\n");
fprintf(stderr, ">> %d CUDA capable GPU device(s) detected. <<\n",
deviceCount);
fprintf(stderr,
">> cudaDeviceInit (-device=%d) is not a valid GPU device. <<\n",
dev);
fprintf(stderr, "\n");
return -dev;
}
checkCudaErrors(cuDeviceGet(&cuDevice, dev));
char name[100];
checkCudaErrors(cuDeviceGetName(name, 100, cuDevice));
int computeMode;
getCudaAttribute<int>(&computeMode, CU_DEVICE_ATTRIBUTE_COMPUTE_MODE, dev);
if (computeMode == CU_COMPUTEMODE_PROHIBITED) {
fprintf(stderr,
"Error: device is running in <CU_COMPUTEMODE_PROHIBITED>, no "
"threads can use this CUDA Device.\n");
return -1;
}
if (checkCmdLineFlag(ARGC, (const char **)ARGV, "quiet") == false) {
printf("gpuDeviceInitDRV() Using CUDA Device [%d]: %s\n", dev, name);
}
return dev;
}
// This function returns the best GPU based on performance
inline int gpuGetMaxGflopsDeviceIdDRV() {
CUdevice current_device = 0;
CUdevice max_perf_device = 0;
int device_count = 0;
int sm_per_multiproc = 0;
unsigned long long max_compute_perf = 0;
int major = 0;
int minor = 0;
int multiProcessorCount;
int clockRate;
int devices_prohibited = 0;
cuInit(0, __CUDA_API_VERSION);
checkCudaErrors(cuDeviceGetCount(&device_count));
if (device_count == 0) {
fprintf(stderr,
"gpuGetMaxGflopsDeviceIdDRV error: no devices supporting CUDA\n");
exit(EXIT_FAILURE);
}
// Find the best CUDA capable GPU device
current_device = 0;
while (current_device < device_count) {
checkCudaErrors(cuDeviceGetAttribute(
&multiProcessorCount, CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT,
current_device));
checkCudaErrors(cuDeviceGetAttribute(
&clockRate, CU_DEVICE_ATTRIBUTE_CLOCK_RATE, current_device));
checkCudaErrors(cuDeviceGetAttribute(
&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, current_device));
checkCudaErrors(cuDeviceGetAttribute(
&minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, current_device));
int computeMode;
getCudaAttribute<int>(&computeMode, CU_DEVICE_ATTRIBUTE_COMPUTE_MODE,
current_device);
if (computeMode != CU_COMPUTEMODE_PROHIBITED) {
if (major == 9999 && minor == 9999) {
sm_per_multiproc = 1;
} else {
sm_per_multiproc = _ConvertSMVer2CoresDRV(major, minor);
}
unsigned long long compute_perf =
(unsigned long long)(multiProcessorCount * sm_per_multiproc *
clockRate);
if (compute_perf > max_compute_perf) {
max_compute_perf = compute_perf;
max_perf_device = current_device;
}
} else {
devices_prohibited++;
}
++current_device;
}
if (devices_prohibited == device_count) {
fprintf(stderr,
"gpuGetMaxGflopsDeviceIdDRV error: all devices have compute mode "
"prohibited.\n");
exit(EXIT_FAILURE);
}
return max_perf_device;
}
// General initialization call to pick the best CUDA Device
inline CUdevice findCudaDeviceDRV(int argc, const char **argv) {
CUdevice cuDevice;
int devID = 0;
// If the command-line has a device number specified, use it
if (checkCmdLineFlag(argc, (const char **)argv, "device")) {
devID = gpuDeviceInitDRV(argc, argv);
if (devID < 0) {
printf("exiting...\n");
exit(EXIT_SUCCESS);
}
} else {
// Otherwise pick the device with highest Gflops/s
char name[100];
devID = gpuGetMaxGflopsDeviceIdDRV();
checkCudaErrors(cuDeviceGet(&cuDevice, devID));
cuDeviceGetName(name, 100, cuDevice);
printf("> Using CUDA Device [%d]: %s\n", devID, name);
}
cuDeviceGet(&cuDevice, devID);
return cuDevice;
}
inline CUdevice findIntegratedGPUDrv() {
CUdevice current_device = 0;
int device_count = 0;
int devices_prohibited = 0;
int isIntegrated;
cuInit(0, __CUDA_API_VERSION);
checkCudaErrors(cuDeviceGetCount(&device_count));
if (device_count == 0) {
fprintf(stderr, "CUDA error: no devices supporting CUDA.\n");
exit(EXIT_FAILURE);
}
// Find the integrated GPU which is compute capable
while (current_device < device_count) {
int computeMode = -1;
checkCudaErrors(cuDeviceGetAttribute(
&isIntegrated, CU_DEVICE_ATTRIBUTE_INTEGRATED, current_device));
checkCudaErrors(cuDeviceGetAttribute(
&computeMode, CU_DEVICE_ATTRIBUTE_COMPUTE_MODE, current_device));
// If GPU is integrated and is not running on Compute Mode prohibited use
// that
if (isIntegrated && (computeMode != CU_COMPUTEMODE_PROHIBITED)) {
int major = 0, minor = 0;
char deviceName[256];
checkCudaErrors(cuDeviceGetAttribute(
&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR,
current_device));
checkCudaErrors(cuDeviceGetAttribute(
&minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR,
current_device));
checkCudaErrors(cuDeviceGetName(deviceName, 256, current_device));
printf("GPU Device %d: \"%s\" with compute capability %d.%d\n\n",
current_device, deviceName, major, minor);
return current_device;
} else {
devices_prohibited++;
}
current_device++;
}
if (devices_prohibited == device_count) {
fprintf(stderr, "CUDA error: No Integrated CUDA capable GPU found.\n");
exit(EXIT_FAILURE);
}
return -1;
}
// General check for CUDA GPU SM Capabilities
inline bool checkCudaCapabilitiesDRV(int major_version, int minor_version,
int devID) {
CUdevice cuDevice;
char name[256];
int major = 0, minor = 0;
checkCudaErrors(cuDeviceGet(&cuDevice, devID));
checkCudaErrors(cuDeviceGetName(name, 100, cuDevice));
checkCudaErrors(cuDeviceGetAttribute(
&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cuDevice));
checkCudaErrors(cuDeviceGetAttribute(
&minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, cuDevice));
if ((major > major_version) ||
(major == major_version && minor >= minor_version)) {
printf("> Device %d: <%16s >, Compute SM %d.%d detected\n", devID, name,
major, minor);
return true;
} else {
printf(
"No GPU device was found that can support CUDA compute capability "
"%d.%d.\n",
major_version, minor_version);
return false;
}
}
#endif
// end of CUDA Helper Functions
#endif // HELPER_CUDA_DRVAPI_H

View File

@@ -0,0 +1,41 @@
/* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NVIDIA CORPORATION nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _MATRIXMUL_H_
#define _MATRIXMUL_H_
// Matrix dimensions
// (chosen as multiples of the thread block size for simplicity)
#define WA (4 * block_size) // Matrix A width
#define HA (6 * block_size) // Matrix A height
#define WB (4 * block_size) // Matrix B width
#define HB WA // Matrix B height
#define WC WB // Matrix C width
#define HC HA // Matrix C height
#endif // _MATRIXMUL_H_

View File

@@ -0,0 +1,355 @@
/* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NVIDIA CORPORATION nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Matrix multiplication: C = A * B.
* Host code.
*
* This sample revisits matrix multiplication with CUDA task. The code of matrix
* multiplication is exactly the same as in matrixMulDrv sample of this SDK.
* This sample, however, demonstrates how to link CUDA driver at runtime and
* how to perform JIT (just-in-time) compilation of CUDA kernel from PTX image,
* stored in memory.
*
* For more details on acquiring auto-generated sources refer README.TXT file
* in "extras" directory.
*
* Unlike CUBLAS, the sample doesn't address high-performance matrix
* multiplication.
*/
// includes, system
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
// includes, CUDA
#include "cuda_drvapi_dynlink.h"
#include "helper_cuda_drvapi.h"
// includes, project
#include "matrixMul.h"
#include "matrixMul_kernel_32_ptxdump.h"
#include "matrixMul_kernel_64_ptxdump.h"
extern "C" void computeGold(float *, const float *, const float *, unsigned int, unsigned int, unsigned int);
#if defined _MSC_VER
#pragma warning (disable : 4312)
#endif
////////////////////////////////////////////////////////////////////////////////
// Globals
////////////////////////////////////////////////////////////////////////////////
CUcontext g_cuContext;
bool noprompt = false;
static const char *sSDKsample = "matrixMulDynlinkJIT (CUDA dynamic linking)";
////////////////////////////////////////////////////////////////////////////////
// Allocates a matrix with random float entries
////////////////////////////////////////////////////////////////////////////////
void randomInit(float *data, size_t size)
{
for (size_t i = 0; i < size; ++i)
{
data[i] = rand() / (float)RAND_MAX;
}
}
////////////////////////////////////////////////////////////////////////////////
// CUDA driver runtime linking and initialization
////////////////////////////////////////////////////////////////////////////////
CUresult initCUDA(int argc, char **argv, CUfunction *pMatrixMul, int *block_size_out)
{
CUresult status;
CUdevice cuDevice;
CUmodule cuModule;
CUfunction cuFunction;
int major, minor, block_size, devID = 0;
char deviceName[256];
// link to cuda driver dynamically
checkCudaErrors(cuInit(0, __CUDA_API_VERSION));
// This assumes that the user is attempting to specify a explicit device -device=n
if (argc > 1)
{
bool bFound = false;
for (int param=0; param < argc; param++)
{
if (!strncmp(argv[param], "-device", 7))
{
int i=(int)strlen(argv[1]);
while (argv[1][i] != '=')
{
i--;
}
devID = atoi(&argv[1][++i]);
bFound = true;
}
if (bFound)
break;
}
}
// get cuda-capable device count
int deviceCount = 0;
checkCudaErrors(cuDeviceGetCount(&deviceCount));
if (deviceCount == 0)
{
fprintf(stderr, "No devices supporting CUDA detected, exiting...\n");
exit(EXIT_SUCCESS);
}
if (devID < 0) devID = 0;
if (devID > deviceCount -1)
{
fprintf(stderr, "initCUDA (Device=%d) invalid GPU device. %d GPU device(s) detected.\n\n", devID, deviceCount);
status = CUDA_ERROR_NOT_FOUND;
cuCtxDestroy(g_cuContext);
exit(EXIT_FAILURE);
}
// pick up device with zero ordinal (default, or devID)
checkCudaErrors(cuDeviceGet(&cuDevice, devID));
// get compute capabilities and the devicename
checkCudaErrors(cuDeviceComputeCapability(&major, &minor, cuDevice));
checkCudaErrors(cuDeviceGetName(deviceName, 256, cuDevice));
printf("> Device %d: \"%s\" with Compute %d.%d capability\n", cuDevice, deviceName, major, minor);
block_size = 32;
*block_size_out = block_size;
// create context for picked device
status = cuCtxCreate(&g_cuContext, 0, cuDevice);
if (CUDA_SUCCESS != status)
{
cuCtxDestroy(g_cuContext);
exit(EXIT_SUCCESS);
}
// setup JIT compilation options and perform compilation
{
// in this branch we use compilation with parameters
const unsigned int jitNumOptions = 3;
CUjit_option *jitOptions = new CUjit_option[jitNumOptions];
void **jitOptVals = new void *[jitNumOptions];
// set up size of compilation log buffer
jitOptions[0] = CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES;
int jitLogBufferSize = 1024;
jitOptVals[0] = (void *)(size_t)jitLogBufferSize;
// set up pointer to the compilation log buffer
jitOptions[1] = CU_JIT_INFO_LOG_BUFFER;
char *jitLogBuffer = new char[jitLogBufferSize];
jitOptVals[1] = jitLogBuffer;
// set up pointer to set the Maximum # of registers for a particular kernel
jitOptions[2] = CU_JIT_MAX_REGISTERS;
int jitRegCount = 32;
jitOptVals[2] = (void *)(size_t)jitRegCount;
// compile with set parameters
printf("> Compiling CUDA module\n");
#if defined(_WIN64) || defined(__LP64__)
status = cuModuleLoadDataEx(&cuModule, matrixMul_kernel_64_ptxdump, jitNumOptions, jitOptions, (void **)jitOptVals);
#else
status = cuModuleLoadDataEx(&cuModule, matrixMul_kernel_32_ptxdump, jitNumOptions, jitOptions, (void **)jitOptVals);
#endif
printf("> PTX JIT log:\n%s\n", jitLogBuffer);
delete [] jitOptions;
delete [] jitOptVals;
delete [] jitLogBuffer;
}
if (CUDA_SUCCESS != status)
{
printf("Error while compiling PTX\n");
cuCtxDestroy(g_cuContext);
exit(EXIT_FAILURE);
}
// retrieve CUDA function from the compiled module
status = cuModuleGetFunction(&cuFunction, cuModule,
(block_size == 16) ? "matrixMul_bs16_32bit" : "matrixMul_bs32_32bit");
if (CUDA_SUCCESS != status)
{
cuCtxDestroy(g_cuContext);
exit(EXIT_FAILURE);
}
*pMatrixMul = cuFunction;
return CUDA_SUCCESS;
}
////////////////////////////////////////////////////////////////////////////////
// Entry point
////////////////////////////////////////////////////////////////////////////////
int main(int argc, char **argv)
{
printf("[ %s ]\n", sSDKsample);
// initialize CUDA
CUfunction matrixMul = NULL;
int block_size = 0;
checkCudaErrors(initCUDA(argc, argv, &matrixMul, &block_size));
// set seed for rand()
srand(2006);
// allocate host memory for matrices A and B
size_t size_A = WA * HA;
size_t mem_size_A = sizeof(float) * size_A;
size_t size_B = WB * HB;
size_t mem_size_B = sizeof(float) * size_B;
float *h_A = (float *) malloc(mem_size_A);
float *h_B = (float *) malloc(mem_size_B);
// initialize host memory
randomInit(h_A, size_A);
randomInit(h_B, size_B);
// allocate device memory
CUdeviceptr d_A;
checkCudaErrors(cuMemAlloc(&d_A, mem_size_A));
CUdeviceptr d_B;
checkCudaErrors(cuMemAlloc(&d_B, mem_size_B));
// copy host memory to device
checkCudaErrors(cuMemcpyHtoD(d_A, h_A, mem_size_A));
checkCudaErrors(cuMemcpyHtoD(d_B, h_B, mem_size_B));
// allocate device memory for result
size_t size_C = WC * HC;
size_t mem_size_C = sizeof(float) * size_C;
CUdeviceptr d_C;
checkCudaErrors(cuMemAlloc(&d_C, mem_size_C));
// allocate mem for the result on host side
float *h_C = (float *) malloc(mem_size_C);
#if __CUDA_API_VERSION >= 4000
{
// This is the new CUDA 4.0 API for Kernel Parameter passing and Kernel Launching (simpler method)
int Matrix_Width_A = WA;
int Matrix_Width_B = WB;
void *args[5] = { &d_C, &d_A, &d_B, &Matrix_Width_A, &Matrix_Width_B };
checkCudaErrors(cuLaunchKernel(matrixMul, (WC/block_size), (HC/block_size), 1,
block_size , block_size , 1,
0,
NULL, args, NULL));
}
#else // __CUDA_API_VERSION <= 3020
{
// This is the older CUDA Driver API for Kernel Parameter passing and Kernel Launching
int offset = 0;
{
// setup execution parameters
checkCudaErrors(cuParamSetv(matrixMul, offset, &d_C, sizeof(d_C)));
offset += sizeof(d_C);
checkCudaErrors(cuParamSetv(matrixMul, offset, &d_A, sizeof(d_A)));
offset += sizeof(d_A);
checkCudaErrors(cuParamSetv(matrixMul, offset, &d_B, sizeof(d_B)));
offset += sizeof(d_B);
}
int Matrix_Width_A = WA;
int Matrix_Width_B = WB;
checkCudaErrors(cuParamSeti(matrixMul, offset, Matrix_Width_A));
offset += sizeof(Matrix_Width_A);
checkCudaErrors(cuParamSeti(matrixMul, offset, Matrix_Width_B));
offset += sizeof(Matrix_Width_B);
checkCudaErrors(cuParamSetSize(matrixMul, offset));
checkCudaErrors(cuFuncSetBlockShape(matrixMul, block_size, block_size, 1));
checkCudaErrors(cuFuncSetSharedSize(matrixMul, 2*block_size*block_size*sizeof(float)));
// set execution configuration for the CUDA kernel
checkCudaErrors(cuLaunchGrid(matrixMul, WC / block_size, HC / block_size));
}
#endif
checkCudaErrors(cuCtxSynchronize());
// copy result from device to host
checkCudaErrors(cuMemcpyDtoH((void *) h_C, d_C, mem_size_C));
// compute reference solution
float *reference = (float *) malloc(mem_size_C);
computeGold(reference, h_A, h_B, HA, WA, WB);
// check result
float diff=0.0f;
for (unsigned int i=0; i<size_C; i++)
{
float tmp = reference[i] - h_C[i];
diff += tmp*tmp;
}
int res = (diff / (float)size_C < 1e-6f);
// clean up memory
free(h_A);
free(h_B);
free(h_C);
free(reference);
checkCudaErrors(cuMemFree(d_A));
checkCudaErrors(cuMemFree(d_B));
checkCudaErrors(cuMemFree(d_C));
checkCudaErrors(cuCtxDestroy(g_cuContext));
printf("Test run %s\n", (1==res) ? "success!" : "failed!");
exit((1 == res) ? EXIT_SUCCESS : EXIT_FAILURE);
}

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2017
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "matrixMulDynlinkJIT", "matrixMulDynlinkJIT_vs2017.vcxproj", "{997E0757-EA74-4A4E-A0FC-47D8C8831A15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Debug|x64.ActiveCfg = Debug|x64
{997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Debug|x64.Build.0 = Debug|x64
{997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Release|x64.ActiveCfg = Release|x64
{997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CUDAPropsPath Condition="'$(CUDAPropsPath)'==''">$(VCTargetsPath)\BuildCustomizations</CUDAPropsPath>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{997E0757-EA74-4A4E-A0FC-47D8C8831A15}</ProjectGuid>
<RootNamespace>matrixMulDynlinkJIT_vs2017</RootNamespace>
<ProjectName>matrixMulDynlinkJIT</ProjectName>
<CudaToolkitCustomDir />
</PropertyGroup>
<PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'==''">
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
<TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup>
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="$(CUDAPropsPath)\CUDA 11.6.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(Platform)/$(Configuration)/</IntDir>
<IncludePath>$(IncludePath)</IncludePath>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='x64'">
<OutDir>../../../bin/win64/$(Configuration)/</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>./;$(CudaToolkitDir)/include;../../../Common;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>cudart_static.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(CudaToolkitLibDir);</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)/matrixMulDynlinkJIT.exe</OutputFile>
</Link>
<CudaCompile>
<CodeGeneration>compute_35,compute_35;</CodeGeneration>
<AdditionalOptions>-Xcompiler "/wd 4819" --threads 0 </AdditionalOptions>
<Include>./;../../../Common</Include>
<Defines>WIN32</Defines>
</CudaCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
</Link>
<CudaCompile>
<Runtime>MTd</Runtime>
<TargetMachinePlatform>64</TargetMachinePlatform>
</CudaCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
<CudaCompile>
<Runtime>MT</Runtime>
<TargetMachinePlatform>64</TargetMachinePlatform>
</CudaCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="cuda_drvapi_dynlink.c" />
<ClCompile Include="matrixMulDynlinkJIT.cpp" />
<ClCompile Include="matrixMul_gold.cpp" />
<ClCompile Include="matrixMul_kernel_32_ptxdump.c" />
<ClCompile Include="matrixMul_kernel_64_ptxdump.c" />
<ClInclude Include="cuda_drvapi_dynlink.h" />
<ClInclude Include="cuda_drvapi_dynlink_cuda.h" />
<ClInclude Include="helper_cuda_drvapi.h" />
<ClInclude Include="matrixMul.h" />
<ClInclude Include="matrixMul_kernel_32_ptxdump.h" />
<ClInclude Include="matrixMul_kernel_64_ptxdump.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(CUDAPropsPath)\CUDA 11.6.targets" />
</ImportGroup>
</Project>

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2019
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "matrixMulDynlinkJIT", "matrixMulDynlinkJIT_vs2019.vcxproj", "{997E0757-EA74-4A4E-A0FC-47D8C8831A15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Debug|x64.ActiveCfg = Debug|x64
{997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Debug|x64.Build.0 = Debug|x64
{997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Release|x64.ActiveCfg = Release|x64
{997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CUDAPropsPath Condition="'$(CUDAPropsPath)'==''">$(VCTargetsPath)\BuildCustomizations</CUDAPropsPath>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{997E0757-EA74-4A4E-A0FC-47D8C8831A15}</ProjectGuid>
<RootNamespace>matrixMulDynlinkJIT_vs2019</RootNamespace>
<ProjectName>matrixMulDynlinkJIT</ProjectName>
<CudaToolkitCustomDir />
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup>
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="$(CUDAPropsPath)\CUDA 11.6.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(Platform)/$(Configuration)/</IntDir>
<IncludePath>$(IncludePath)</IncludePath>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='x64'">
<OutDir>../../../bin/win64/$(Configuration)/</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>./;$(CudaToolkitDir)/include;../../../Common;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>cudart_static.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(CudaToolkitLibDir);</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)/matrixMulDynlinkJIT.exe</OutputFile>
</Link>
<CudaCompile>
<CodeGeneration>compute_35,compute_35;</CodeGeneration>
<AdditionalOptions>-Xcompiler "/wd 4819" --threads 0 </AdditionalOptions>
<Include>./;../../../Common</Include>
<Defines>WIN32</Defines>
</CudaCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
</Link>
<CudaCompile>
<Runtime>MTd</Runtime>
<TargetMachinePlatform>64</TargetMachinePlatform>
</CudaCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
<CudaCompile>
<Runtime>MT</Runtime>
<TargetMachinePlatform>64</TargetMachinePlatform>
</CudaCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="cuda_drvapi_dynlink.c" />
<ClCompile Include="matrixMulDynlinkJIT.cpp" />
<ClCompile Include="matrixMul_gold.cpp" />
<ClCompile Include="matrixMul_kernel_32_ptxdump.c" />
<ClCompile Include="matrixMul_kernel_64_ptxdump.c" />
<ClInclude Include="cuda_drvapi_dynlink.h" />
<ClInclude Include="cuda_drvapi_dynlink_cuda.h" />
<ClInclude Include="helper_cuda_drvapi.h" />
<ClInclude Include="matrixMul.h" />
<ClInclude Include="matrixMul_kernel_32_ptxdump.h" />
<ClInclude Include="matrixMul_kernel_64_ptxdump.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(CUDAPropsPath)\CUDA 11.6.targets" />
</ImportGroup>
</Project>

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2022
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "matrixMulDynlinkJIT", "matrixMulDynlinkJIT_vs2022.vcxproj", "{997E0757-EA74-4A4E-A0FC-47D8C8831A15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Debug|x64.ActiveCfg = Debug|x64
{997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Debug|x64.Build.0 = Debug|x64
{997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Release|x64.ActiveCfg = Release|x64
{997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CUDAPropsPath Condition="'$(CUDAPropsPath)'==''">$(VCTargetsPath)\BuildCustomizations</CUDAPropsPath>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{997E0757-EA74-4A4E-A0FC-47D8C8831A15}</ProjectGuid>
<RootNamespace>matrixMulDynlinkJIT_vs2022</RootNamespace>
<ProjectName>matrixMulDynlinkJIT</ProjectName>
<CudaToolkitCustomDir />
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup>
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="$(CUDAPropsPath)\CUDA 11.6.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(Platform)/$(Configuration)/</IntDir>
<IncludePath>$(IncludePath)</IncludePath>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='x64'">
<OutDir>../../../bin/win64/$(Configuration)/</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>./;$(CudaToolkitDir)/include;../../../Common;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>cudart_static.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(CudaToolkitLibDir);</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)/matrixMulDynlinkJIT.exe</OutputFile>
</Link>
<CudaCompile>
<CodeGeneration>compute_35,compute_35;</CodeGeneration>
<AdditionalOptions>-Xcompiler "/wd 4819" --threads 0 </AdditionalOptions>
<Include>./;../../../Common</Include>
<Defines>WIN32</Defines>
</CudaCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
</Link>
<CudaCompile>
<Runtime>MTd</Runtime>
<TargetMachinePlatform>64</TargetMachinePlatform>
</CudaCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
<CudaCompile>
<Runtime>MT</Runtime>
<TargetMachinePlatform>64</TargetMachinePlatform>
</CudaCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="cuda_drvapi_dynlink.c" />
<ClCompile Include="matrixMulDynlinkJIT.cpp" />
<ClCompile Include="matrixMul_gold.cpp" />
<ClCompile Include="matrixMul_kernel_32_ptxdump.c" />
<ClCompile Include="matrixMul_kernel_64_ptxdump.c" />
<ClInclude Include="cuda_drvapi_dynlink.h" />
<ClInclude Include="cuda_drvapi_dynlink_cuda.h" />
<ClInclude Include="helper_cuda_drvapi.h" />
<ClInclude Include="matrixMul.h" />
<ClInclude Include="matrixMul_kernel_32_ptxdump.h" />
<ClInclude Include="matrixMul_kernel_64_ptxdump.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(CUDAPropsPath)\CUDA 11.6.targets" />
</ImportGroup>
</Project>

View File

@@ -0,0 +1,60 @@
/* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NVIDIA CORPORATION nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
////////////////////////////////////////////////////////////////////////////////
// export C interface
extern "C"
void computeGold(float *, const float *, const float *, unsigned int, unsigned int, unsigned int);
////////////////////////////////////////////////////////////////////////////////
//! Compute reference data set
//! C = A * B
//! @param C reference data, computed but preallocated
//! @param A matrix A as provided to device
//! @param B matrix B as provided to device
//! @param hA height of matrix A
//! @param wB width of matrix B
////////////////////////////////////////////////////////////////////////////////
void
computeGold(float *C, const float *A, const float *B, unsigned int hA, unsigned int wA, unsigned int wB)
{
for (unsigned int i = 0; i < hA; ++i)
for (unsigned int j = 0; j < wB; ++j)
{
double sum = 0;
for (unsigned int k = 0; k < wA; ++k)
{
double a = A[i * wA + k];
double b = B[k * wB + j];
sum += a * b;
}
C[i * wB + j] = (float)sum;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
/* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NVIDIA CORPORATION nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
////////////////////////////////////////////////////////////////////////////////
// This file is auto-generated, do not edit
////////////////////////////////////////////////////////////////////////////////
#ifndef __matrixMul_kernel_32_ptxdump_h__
#define __matrixMul_kernel_32_ptxdump_h__
#if defined __cplusplus
extern "C" {
#endif
extern unsigned char matrixMul_kernel_32_ptxdump[25784];
#if defined __cplusplus
}
#endif
#endif //__matrixMul_kernel_32_ptxdump_h__

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
/* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NVIDIA CORPORATION nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
////////////////////////////////////////////////////////////////////////////////
// This file is auto-generated, do not edit
////////////////////////////////////////////////////////////////////////////////
#ifndef __matrixMul_kernel_64_ptxdump_h__
#define __matrixMul_kernel_64_ptxdump_h__
#if defined __cplusplus
extern "C" {
#endif
extern unsigned char matrixMul_kernel_64_ptxdump[26489];
#if defined __cplusplus
}
#endif
#endif //__matrixMul_kernel_64_ptxdump_h__