mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-08-04 23:30:53 +00:00
Regenerate main CUDA header, fix zluda_dump
This commit is contained in:
parent
970ba5aa25
commit
13c6d3dd94
12 changed files with 8975 additions and 5922 deletions
|
@ -8,16 +8,27 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && DEBIAN_FRONTEND=noninter
|
||||||
python3 \
|
python3 \
|
||||||
ripgrep \
|
ripgrep \
|
||||||
git \
|
git \
|
||||||
ltrace
|
ltrace \
|
||||||
|
# required by llvm 17
|
||||||
|
lsb-release software-properties-common gnupg
|
||||||
|
|
||||||
|
ARG LLVM_VERSION=17
|
||||||
|
RUN wget https://apt.llvm.org/llvm.sh && \
|
||||||
|
chmod +x llvm.sh && \
|
||||||
|
./llvm.sh ${LLVM_VERSION}
|
||||||
|
|
||||||
# Feel free to change to a newer version if you have a newer verison on your host
|
# Feel free to change to a newer version if you have a newer verison on your host
|
||||||
ARG CUDA_VERSION=12-4
|
ARG CUDA_PKG_VERSION=12-4
|
||||||
# Docker <-> host driver version compatiblity is newer host <-> older docker
|
# Docker <-> host driver version compatiblity is newer host <-> older docker
|
||||||
# We don't care about a specific driver version, so pick oldest 5XX
|
# We don't care about a specific driver version, so pick oldest 5XX
|
||||||
ARG CUDA_DRIVER=515
|
ARG CUDA_DRIVER=515
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||||
|
# CUDA headers need it for interop
|
||||||
|
libgl-dev libegl-dev libvdpau-dev \
|
||||||
nvidia-utils-${CUDA_DRIVER} \
|
nvidia-utils-${CUDA_DRIVER} \
|
||||||
cuda-cudart-${CUDA_VERSION}
|
cuda-cudart-dev-${CUDA_PKG_VERSION} \
|
||||||
|
cuda-cudart-${CUDA_PKG_VERSION} \
|
||||||
|
cuda-profiler-api-${CUDA_PKG_VERSION}
|
||||||
|
|
||||||
ARG ROCM_VERSION=6.2.2
|
ARG ROCM_VERSION=6.2.2
|
||||||
RUN mkdir --parents --mode=0755 /etc/apt/keyrings && \
|
RUN mkdir --parents --mode=0755 /etc/apt/keyrings && \
|
||||||
|
@ -29,9 +40,10 @@ RUN mkdir --parents --mode=0755 /etc/apt/keyrings && \
|
||||||
rocminfo \
|
rocminfo \
|
||||||
rocm-gdb \
|
rocm-gdb \
|
||||||
rocm-smi-lib \
|
rocm-smi-lib \
|
||||||
|
rocm-llvm-dev \
|
||||||
hip-runtime-amd && \
|
hip-runtime-amd && \
|
||||||
echo '/opt/rocm/lib' > /etc/ld.so.conf.d/rocm.conf && \
|
echo '/opt/rocm/lib' > /etc/ld.so.conf.d/rocm.conf && \
|
||||||
ldconfig
|
ldconfig
|
||||||
|
|
||||||
ENV PATH=$PATH:/opt/rocm-6.2.2/bin
|
ENV PATH=$PATH:/opt/rocm-${ROCM_VERSION}/bin
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
//"hostRequirements": { "gpu": "optional" }
|
//"hostRequirements": { "gpu": "optional" }
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [ "mhutchie.git-graph" ],
|
"extensions": [ "mhutchie.git-graph" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
bindgen build/wrapper.h -o src/cuda.rs --no-partialeq "CUDA_HOST_NODE_PARAMS_st" --with-derive-eq --whitelist-function="^cu.*" --whitelist-var="^CU.*" --size_t-is-usize --default-enum-style=newtype --no-layout-tests --no-doc-comments --no-derive-debug --new-type-alias "^CUdevice_v\d+$|^CUdeviceptr_v\d+$" --must-use-type "cudaError_enum" -- -I/usr/local/cuda/include
|
bindgen build/wrapper.h -o src/cuda.rs --no-partialeq "CUDA_HOST_NODE_PARAMS_st" --with-derive-eq --allowlist-type="^CU.*" --allowlist-function="^cu.*" --allowlist-var="^CU.*" --default-enum-style=newtype --no-layout-tests --no-doc-comments --no-derive-debug --new-type-alias "^CUdevice_v\d+$|^CUdeviceptr_v\d+$" --must-use-type "cudaError_enum" -- -I/usr/local/cuda/include
|
|
@ -1,3 +1,7 @@
|
||||||
#define __CUDA_API_VERSION_INTERNAL
|
#define __CUDA_API_VERSION_INTERNAL
|
||||||
#include <cuda.h>
|
#include <cuda.h>
|
||||||
#include <cudaGL.h>
|
#include <cudaProfiler.h>
|
||||||
|
#include <cudaGL.h>
|
||||||
|
#include <cudaEGL.h>
|
||||||
|
#include <vdpau/vdpau.h>
|
||||||
|
#include <cudaVDPAU.h>
|
||||||
|
|
14615
cuda_base/src/cuda.rs
14615
cuda_base/src/cuda.rs
File diff suppressed because it is too large
Load diff
|
@ -216,6 +216,8 @@ fn prepend_cuda_path_to_path(base_path: &Path, path: Path) -> Path {
|
||||||
if ident.starts_with("CU")
|
if ident.starts_with("CU")
|
||||||
|| ident.starts_with("cu")
|
|| ident.starts_with("cu")
|
||||||
|| ident.starts_with("GL")
|
|| ident.starts_with("GL")
|
||||||
|
|| ident.starts_with("EGL")
|
||||||
|
|| ident.starts_with("Vdp")
|
||||||
|| ident == "HGPUNV"
|
|| ident == "HGPUNV"
|
||||||
{
|
{
|
||||||
let mut base_path = base_path.clone();
|
let mut base_path = base_path.clone();
|
||||||
|
@ -343,11 +345,10 @@ fn cuda_derive_display_trait_for_item(
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
Item::Struct(item_struct) => {
|
Item::Struct(item_struct) => {
|
||||||
let item_struct_name = item_struct.ident.to_string();
|
|
||||||
if state.ignore_types.contains(&item_struct.ident) {
|
if state.ignore_types.contains(&item_struct.ident) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
if item_struct_name.ends_with("_enum") {
|
if state.enums.contains_key(&item_struct.ident) {
|
||||||
let enum_ = &item_struct.ident;
|
let enum_ = &item_struct.ident;
|
||||||
let enum_iter = iter::repeat(&item_struct.ident);
|
let enum_iter = iter::repeat(&item_struct.ident);
|
||||||
let variants = state.enums.get(&item_struct.ident).unwrap().iter();
|
let variants = state.enums.get(&item_struct.ident).unwrap().iter();
|
||||||
|
|
|
@ -284,20 +284,40 @@ fn immediate_value<'a, 'input>(stream: &mut PtxParser<'a, 'input>) -> PResult<as
|
||||||
.parse_next(stream)
|
.parse_next(stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_module_unchecked<'input>(text: &'input str) -> Option<ast::Module<'input>> {
|
pub fn parse_for_errors<'input>(text: &'input str) -> Vec<PtxError> {
|
||||||
let input = lex_with_span(text).ok()?;
|
let (tokens, mut errors) = lex_with_span_unchecked(text);
|
||||||
let mut errors = Vec::new();
|
let parse_result = {
|
||||||
let state = PtxParserState::new(text, &mut errors);
|
let state = PtxParserState::new(text, &mut errors);
|
||||||
let parser = PtxParser {
|
let parser = PtxParser {
|
||||||
state,
|
state,
|
||||||
input: &input[..],
|
input: &tokens[..],
|
||||||
|
};
|
||||||
|
module
|
||||||
|
.parse(parser)
|
||||||
|
.map_err(|err| PtxError::Parser(err.into_inner()))
|
||||||
};
|
};
|
||||||
let parsing_result = module.parse(parser).ok();
|
match parse_result {
|
||||||
if !errors.is_empty() {
|
Ok(_) => {}
|
||||||
None
|
Err(err) => {
|
||||||
} else {
|
errors.push(err);
|
||||||
parsing_result
|
}
|
||||||
}
|
}
|
||||||
|
errors
|
||||||
|
}
|
||||||
|
|
||||||
|
fn lex_with_span_unchecked<'input>(
|
||||||
|
text: &'input str,
|
||||||
|
) -> (Vec<(Token<'input>, logos::Span)>, Vec<PtxError>) {
|
||||||
|
let lexer = Token::lexer(text);
|
||||||
|
let mut result = Vec::new();
|
||||||
|
let mut errors = Vec::new();
|
||||||
|
for (token, span) in lexer.spanned() {
|
||||||
|
match token {
|
||||||
|
Ok(t) => result.push((t, span)),
|
||||||
|
Err(err) => errors.push(PtxError::Lexer { source: err }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(result, errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_module_checked<'input>(
|
pub fn parse_module_checked<'input>(
|
||||||
|
@ -342,17 +362,6 @@ pub fn parse_module_checked<'input>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lex_with_span<'input>(
|
|
||||||
text: &'input str,
|
|
||||||
) -> Result<Vec<(Token<'input>, logos::Span)>, TokenError> {
|
|
||||||
let lexer = Token::lexer(text);
|
|
||||||
let mut result = Vec::new();
|
|
||||||
for (token, span) in lexer.spanned() {
|
|
||||||
result.push((token?, span));
|
|
||||||
}
|
|
||||||
Ok(result)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn module<'a, 'input>(stream: &mut PtxParser<'a, 'input>) -> PResult<ast::Module<'input>> {
|
fn module<'a, 'input>(stream: &mut PtxParser<'a, 'input>) -> PResult<ast::Module<'input>> {
|
||||||
(
|
(
|
||||||
version,
|
version,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "zluda_dump"
|
name = "zluda_dump"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
authors = ["Andrzej Janik <vosen@vosen.pl>"]
|
authors = ["Andrzej Janik <vosen@vosen.pl>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "zluda_dump"
|
name = "zluda_dump"
|
||||||
|
@ -10,6 +10,7 @@ crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ptx = { path = "../ptx" }
|
ptx = { path = "../ptx" }
|
||||||
|
ptx_parser = { path = "../ptx_parser" }
|
||||||
lz4-sys = "1.9"
|
lz4-sys = "1.9"
|
||||||
regex = "1.4"
|
regex = "1.4"
|
||||||
dynasm = "1.2"
|
dynasm = "1.2"
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
|
use cuda_base::cuda_derive_display_trait;
|
||||||
use std::{
|
use std::{
|
||||||
ffi::{c_void, CStr},
|
ffi::{c_void, CStr},
|
||||||
fmt::LowerHex,
|
fmt::LowerHex,
|
||||||
mem, ptr, slice,
|
mem, ptr, slice,
|
||||||
};
|
};
|
||||||
|
|
||||||
use cuda_base::cuda_derive_display_trait;
|
|
||||||
|
|
||||||
pub(crate) trait CudaDisplay {
|
pub(crate) trait CudaDisplay {
|
||||||
fn write(
|
fn write(
|
||||||
&self,
|
&self,
|
||||||
|
@ -494,6 +493,59 @@ impl CudaDisplay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CudaDisplay for cuda_types::CUgraphNodeParams_st {
|
||||||
|
fn write(
|
||||||
|
&self,
|
||||||
|
_fn_name: &'static str,
|
||||||
|
_index: usize,
|
||||||
|
_writer: &mut (impl std::io::Write + ?Sized),
|
||||||
|
) -> std::io::Result<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CudaDisplay for cuda_types::CUlaunchConfig_st {
|
||||||
|
fn write(
|
||||||
|
&self,
|
||||||
|
_fn_name: &'static str,
|
||||||
|
_index: usize,
|
||||||
|
_writer: &mut (impl std::io::Write + ?Sized),
|
||||||
|
) -> std::io::Result<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CudaDisplay for cuda_types::CUeglFrame_st {
|
||||||
|
fn write(
|
||||||
|
&self,
|
||||||
|
_fn_name: &'static str,
|
||||||
|
_index: usize,
|
||||||
|
_writer: &mut (impl std::io::Write + ?Sized),
|
||||||
|
) -> std::io::Result<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CudaDisplay for cuda_types::CUdevResource_st {
|
||||||
|
fn write(
|
||||||
|
&self,
|
||||||
|
_fn_name: &'static str,
|
||||||
|
_index: usize,
|
||||||
|
_writer: &mut (impl std::io::Write + ?Sized),
|
||||||
|
) -> std::io::Result<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl CudaDisplay for cuda_types::CUlaunchAttribute_st {
|
||||||
|
fn write(
|
||||||
|
&self,
|
||||||
|
_fn_name: &'static str,
|
||||||
|
_index: usize,
|
||||||
|
_writer: &mut (impl std::io::Write + ?Sized),
|
||||||
|
) -> std::io::Result<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
impl<T: CudaDisplay> CudaDisplay for *mut T {
|
impl<T: CudaDisplay> CudaDisplay for *mut T {
|
||||||
fn write(
|
fn write(
|
||||||
&self,
|
&self,
|
||||||
|
@ -585,27 +637,7 @@ pub fn write_cuGraphKernelNodeGetAttribute(
|
||||||
CudaDisplay::write(&hNode, "cuGraphKernelNodeGetAttribute", 0, writer)?;
|
CudaDisplay::write(&hNode, "cuGraphKernelNodeGetAttribute", 0, writer)?;
|
||||||
writer.write_all(b", attr: ")?;
|
writer.write_all(b", attr: ")?;
|
||||||
CudaDisplay::write(&attr, "cuGraphKernelNodeGetAttribute", 1, writer)?;
|
CudaDisplay::write(&attr, "cuGraphKernelNodeGetAttribute", 1, writer)?;
|
||||||
match attr {
|
write_launch_attribute(writer, "cuGraphKernelNodeGetAttribute", 2, attr, value_out)?;
|
||||||
cuda_types::CUkernelNodeAttrID::CU_KERNEL_NODE_ATTRIBUTE_ACCESS_POLICY_WINDOW => {
|
|
||||||
writer.write_all(b", value_out: ")?;
|
|
||||||
CudaDisplay::write(
|
|
||||||
unsafe { &(*value_out).accessPolicyWindow },
|
|
||||||
"cuGraphKernelNodeGetAttribute",
|
|
||||||
2,
|
|
||||||
writer,
|
|
||||||
)?;
|
|
||||||
}
|
|
||||||
cuda_types::CUkernelNodeAttrID::CU_KERNEL_NODE_ATTRIBUTE_COOPERATIVE => {
|
|
||||||
writer.write_all(b", value_out: ")?;
|
|
||||||
CudaDisplay::write(
|
|
||||||
unsafe { &(*value_out).cooperative },
|
|
||||||
"cuGraphKernelNodeGetAttribute",
|
|
||||||
2,
|
|
||||||
writer,
|
|
||||||
)?;
|
|
||||||
}
|
|
||||||
_ => return writer.write_all(b", ...) "),
|
|
||||||
}
|
|
||||||
writer.write_all(b") ")
|
writer.write_all(b") ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,28 +662,73 @@ pub fn write_cuStreamGetAttribute(
|
||||||
CudaDisplay::write(&hStream, "cuStreamGetAttribute", 0, writer)?;
|
CudaDisplay::write(&hStream, "cuStreamGetAttribute", 0, writer)?;
|
||||||
writer.write_all(b", attr: ")?;
|
writer.write_all(b", attr: ")?;
|
||||||
CudaDisplay::write(&attr, "cuStreamGetAttribute", 1, writer)?;
|
CudaDisplay::write(&attr, "cuStreamGetAttribute", 1, writer)?;
|
||||||
match attr {
|
write_launch_attribute(writer, "cuStreamGetAttribute", 2, attr, value_out)?;
|
||||||
cuda_types::CUstreamAttrID::CU_STREAM_ATTRIBUTE_ACCESS_POLICY_WINDOW => {
|
writer.write_all(b") ")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_launch_attribute(
|
||||||
|
writer: &mut (impl std::io::Write + ?Sized),
|
||||||
|
fn_name: &'static str,
|
||||||
|
index: usize,
|
||||||
|
attribute: cuda_types::CUlaunchAttributeID,
|
||||||
|
value_out: *mut cuda_types::CUstreamAttrValue,
|
||||||
|
) -> std::io::Result<()> {
|
||||||
|
match attribute {
|
||||||
|
cuda_types::CUlaunchAttributeID::CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW => {
|
||||||
writer.write_all(b", value_out: ")?;
|
writer.write_all(b", value_out: ")?;
|
||||||
CudaDisplay::write(
|
CudaDisplay::write(
|
||||||
unsafe { &(*value_out).accessPolicyWindow },
|
unsafe { &(*value_out).accessPolicyWindow },
|
||||||
"cuStreamGetAttribute",
|
fn_name,
|
||||||
2,
|
index,
|
||||||
writer,
|
writer,
|
||||||
)?;
|
)
|
||||||
}
|
}
|
||||||
cuda_types::CUstreamAttrID::CU_STREAM_ATTRIBUTE_SYNCHRONIZATION_POLICY => {
|
cuda_types::CUlaunchAttributeID::CU_LAUNCH_ATTRIBUTE_COOPERATIVE => {
|
||||||
writer.write_all(b", value_out: ")?;
|
writer.write_all(b", value_out: ")?;
|
||||||
CudaDisplay::write(
|
CudaDisplay::write(unsafe { &(*value_out).cooperative }, fn_name, index, writer)
|
||||||
unsafe { &(*value_out).syncPolicy },
|
|
||||||
"cuStreamGetAttribute",
|
|
||||||
2,
|
|
||||||
writer,
|
|
||||||
)?;
|
|
||||||
}
|
}
|
||||||
_ => return writer.write_all(b", ...) "),
|
cuda_types::CUlaunchAttributeID::CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY => {
|
||||||
|
writer.write_all(b", value_out: ")?;
|
||||||
|
CudaDisplay::write(unsafe { &(*value_out).syncPolicy }, fn_name, index, writer)
|
||||||
|
}
|
||||||
|
cuda_types::CUlaunchAttributeID::CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION => {
|
||||||
|
writer.write_all(b", value_out: ")?;
|
||||||
|
CudaDisplay::write(unsafe { &(*value_out).clusterDim }, fn_name, index, writer)
|
||||||
|
}
|
||||||
|
cuda_types::CUlaunchAttributeID::CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE => {
|
||||||
|
writer.write_all(b", value_out: ")?;
|
||||||
|
CudaDisplay::write(unsafe { &(*value_out).clusterSchedulingPolicyPreference }, fn_name, index, writer)
|
||||||
|
}
|
||||||
|
cuda_types::CUlaunchAttributeID::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION => {
|
||||||
|
writer.write_all(b", value_out: ")?;
|
||||||
|
CudaDisplay::write(unsafe { &(*value_out).programmaticStreamSerializationAllowed }, fn_name, index, writer)
|
||||||
|
}
|
||||||
|
cuda_types::CUlaunchAttributeID::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT => {
|
||||||
|
writer.write_all(b", value_out: ")?;
|
||||||
|
CudaDisplay::write(unsafe { &(*value_out).programmaticEvent }, fn_name, index, writer)
|
||||||
|
}
|
||||||
|
cuda_types::CUlaunchAttributeID::CU_LAUNCH_ATTRIBUTE_PRIORITY => {
|
||||||
|
writer.write_all(b", value_out: ")?;
|
||||||
|
CudaDisplay::write(unsafe { &(*value_out).priority }, fn_name, index, writer)
|
||||||
|
}
|
||||||
|
cuda_types::CUlaunchAttributeID::CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP => {
|
||||||
|
writer.write_all(b", value_out: ")?;
|
||||||
|
CudaDisplay::write(unsafe { &(*value_out).memSyncDomainMap }, fn_name, index, writer)
|
||||||
|
}
|
||||||
|
cuda_types::CUlaunchAttributeID::CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN => {
|
||||||
|
writer.write_all(b", value_out: ")?;
|
||||||
|
CudaDisplay::write(unsafe { &(*value_out).memSyncDomain }, fn_name, index, writer)
|
||||||
|
}
|
||||||
|
cuda_types::CUlaunchAttributeID::CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT => {
|
||||||
|
writer.write_all(b", value_out: ")?;
|
||||||
|
CudaDisplay::write(unsafe { &(*value_out).launchCompletionEvent }, fn_name, index, writer)
|
||||||
|
}
|
||||||
|
cuda_types::CUlaunchAttributeID::CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE => {
|
||||||
|
writer.write_all(b", value_out: ")?;
|
||||||
|
CudaDisplay::write(unsafe { &(*value_out).deviceUpdatableKernelNode }, fn_name, index, writer)
|
||||||
|
}
|
||||||
|
_ => writer.write_all(b", ... "),
|
||||||
}
|
}
|
||||||
writer.write_all(b") ")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
@ -737,7 +814,17 @@ cuda_derive_display_trait!(
|
||||||
CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st,
|
CUstreamBatchMemOpParams_union_CUstreamMemOpWaitValueParams_st,
|
||||||
CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st,
|
CUstreamBatchMemOpParams_union_CUstreamMemOpWriteValueParams_st,
|
||||||
CUuuid_st,
|
CUuuid_st,
|
||||||
HGPUNV
|
HGPUNV,
|
||||||
|
EGLint,
|
||||||
|
EGLSyncKHR,
|
||||||
|
EGLImageKHR,
|
||||||
|
EGLStreamKHR,
|
||||||
|
CUasyncNotificationInfo_st,
|
||||||
|
CUgraphNodeParams_st,
|
||||||
|
CUeglFrame_st,
|
||||||
|
CUdevResource_st,
|
||||||
|
CUlaunchAttribute_st,
|
||||||
|
CUlaunchConfig_st
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
cuCtxCreate_v3,
|
cuCtxCreate_v3,
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
use cuda_types::{
|
use cuda_types::*;
|
||||||
CUdevice, CUdevice_attribute, CUfunction, CUjit_option, CUmodule, CUresult, CUuuid,
|
|
||||||
};
|
|
||||||
use paste::paste;
|
use paste::paste;
|
||||||
use side_by_side::CudaDynamicFns;
|
use side_by_side::CudaDynamicFns;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
@ -205,10 +203,10 @@ impl Settings {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let libcuda_path = match env::var("ZLUDA_CUDA_LIB") {
|
let libcuda_path = match env::var("ZLUDA_CUDA_LIB") {
|
||||||
Err(env::VarError::NotPresent) => os::LIBCUDA_DEFAULT_PATH.to_owned(),
|
Err(env::VarError::NotPresent) => os::LIBCUDA_DEFAULT_PATH.to_string(),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
logger.log(log::LogEntry::ErrorBox(Box::new(e) as _));
|
logger.log(log::LogEntry::ErrorBox(Box::new(e) as _));
|
||||||
os::LIBCUDA_DEFAULT_PATH.to_owned()
|
os::LIBCUDA_DEFAULT_PATH.to_string()
|
||||||
}
|
}
|
||||||
Ok(env_string) => env_string,
|
Ok(env_string) => env_string,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::cuda::CUuuid;
|
use cuda_types::CUuuid;
|
||||||
use std::ffi::{c_void, CStr, CString};
|
use std::ffi::{c_void, CStr, CString};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
pub(crate) const LIBCUDA_DEFAULT_PATH: &'static str = b"/usr/lib/x86_64-linux-gnu/libcuda.so.1\0";
|
pub(crate) const LIBCUDA_DEFAULT_PATH: &str = "/usr/lib/x86_64-linux-gnu/libcuda.so.1";
|
||||||
|
|
||||||
pub unsafe fn load_library(libcuda_path: &str) -> *mut c_void {
|
pub unsafe fn load_library(libcuda_path: &str) -> *mut c_void {
|
||||||
let libcuda_path = CString::new(libcuda_path).unwrap();
|
let libcuda_path = CString::new(libcuda_path).unwrap();
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
use ptx::{ast::PtxError, Token};
|
|
||||||
use ptx::{DisplayParseError, ModuleParserExt};
|
|
||||||
|
|
||||||
use crate::{dark_api, log, Settings};
|
use crate::{dark_api, log, Settings};
|
||||||
use cuda_types::CUmodule;
|
use cuda_types::CUmodule;
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -172,7 +169,7 @@ impl StateTracker {
|
||||||
submodule_index: Option<usize>,
|
submodule_index: Option<usize>,
|
||||||
module_text: &str,
|
module_text: &str,
|
||||||
) {
|
) {
|
||||||
let (_ast, errors) = ptx::ModuleParser::parse_unchecked(module_text);
|
let errors = ptx_parser::parse_for_errors(module_text);
|
||||||
if !errors.is_empty() {
|
if !errors.is_empty() {
|
||||||
fn_logger.log(log::LogEntry::ModuleParsingError(
|
fn_logger.log(log::LogEntry::ModuleParsingError(
|
||||||
DumpWriter::get_file_name(module_index, version, submodule_index, "log"),
|
DumpWriter::get_file_name(module_index, version, submodule_index, "log"),
|
||||||
|
@ -232,7 +229,7 @@ impl DumpWriter {
|
||||||
module_index: usize,
|
module_index: usize,
|
||||||
version: Option<usize>,
|
version: Option<usize>,
|
||||||
submodule_index: Option<usize>,
|
submodule_index: Option<usize>,
|
||||||
errors: &[ptx::ParseError<usize, Token<'input>, PtxError>],
|
errors: &[ptx_parser::PtxError<'input>],
|
||||||
) -> io::Result<()> {
|
) -> io::Result<()> {
|
||||||
let mut log_file = match &self.dump_dir {
|
let mut log_file = match &self.dump_dir {
|
||||||
None => return Ok(()),
|
None => return Ok(()),
|
||||||
|
@ -246,8 +243,7 @@ impl DumpWriter {
|
||||||
));
|
));
|
||||||
let mut file = File::create(log_file)?;
|
let mut file = File::create(log_file)?;
|
||||||
for error in errors {
|
for error in errors {
|
||||||
let pretty_print_error = unsafe { DisplayParseError::new(error, module_text) };
|
writeln!(file, "{}", error)?;
|
||||||
writeln!(file, "{}", pretty_print_error)?;
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue