[BUG] nvcv::Tensor constructor segfaults at compile time
Describe the bug I get a Segmentation fault (core dumped) at compile time when trying to compile:
int batchSize{1};
nvcv::Tensor tensor({{batchSize}, "N"}, nvcv::TYPE_S32);
The nvcc compiler version I use (I build for native arch, which is 7.5 on RTX2070):
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Jun__6_02:18:23_PDT_2024
Cuda compilation tools, release 12.5, V12.5.82
Build cuda_12.5.r12.5/compiler.34385749_0
Steps/Code to reproduce bug
This segfaults at compile time:
#include <nvcv/Tensor.hpp>
int main (int argc, const char * argv[]) {
int batchSize{0};
nvcv::Tensor tensor({{batchSize}, "N"}, nvcv::TYPE_S32);
}
This correctly compiles:
#include <nvcv/Tensor.hpp>
int main (int argc, const char * argv[]) {
int batchSize{0};
auto tensorReqs = nvcv::Tensor::CalcRequirements({{batchSize}, "N"}, nvcv::TYPE_S32);
nvcv::Tensor tensor(tensorReqs);
}
Expected behavior A clear and concise description of what you expected to happen.
Environment overview (please complete the following information)
- Environment location: Bare-metal
Environment details
<details><summary>Click here to see environment details</summary><pre>
**git***
commit 84e3dcd2b5dddbf176b083ba8f256a0cd33db160 (grafted, HEAD, tag: v0.11.0-beta, origin/main, origin/HEAD, main)
Author: Miles Price <[email protected]>
Date: Wed Sep 4 17:11:13 2024 -0700
Merge pull request #189 from CVCUDA/feat/milesp/release_cvcuda_0110
feat: adding release v0.11.0 of cvcuda
**git submodules***
ca4d00ad3e2e0f410eeab3264d21b8a39397f362 3rdparty/dlpack (v0.8-1-gca4d00a)
5ab508a01f9eb089207ee87fd547d290da39d015 3rdparty/googletest (release-1.8.0-3127-g5ab508a0)
75212298727e8f6e1df9215f2fcb47c8c721ffc9 3rdparty/nvbench (old-cmake-164-g7521229)
941f45bcb51457884fa1afd6e24a67377d70f75c 3rdparty/pybind11 (v2.11.0-134-g941f45bc)
***OS Information***
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
Linux jcruel-desktop 6.8.0-40-generic #40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
***GPU Information***
Thu Sep 12 14:47:48 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 555.42.06 Driver Version: 555.42.06 CUDA Version: 12.5 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 2060 ... Off | 00000000:01:00.0 On | N/A |
| 24% 44C P8 20W / 175W | 1318MiB / 8192MiB | 14% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 2708 G /usr/lib/xorg/Xorg 853MiB |
| 0 N/A N/A 2885 G /usr/bin/gnome-shell 119MiB |
| 0 N/A N/A 7188 G ...erProcess --variations-seed-version 2MiB |
| 0 N/A N/A 1955173 G ...irefox/4848/usr/lib/firefox/firefox 0MiB |
| 0 N/A N/A 2288194 G ...erProcess --variations-seed-version 113MiB |
+-----------------------------------------------------------------------------------------+
***CPU***
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 39 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 6
On-line CPU(s) list: 0-5
Vendor ID: GenuineIntel
Model name: Intel(R) Core(TM) i5-9600KF CPU @ 3.70GHz
CPU family: 6
Model: 158
Thread(s) per core: 1
Core(s) per socket: 6
Socket(s): 1
Stepping: 13
CPU max MHz: 4600.0000
CPU min MHz: 800.0000
BogoMIPS: 7399.70
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
Virtualization: VT-x
L1d cache: 192 KiB (6 instances)
L1i cache: 192 KiB (6 instances)
L2 cache: 1.5 MiB (6 instances)
L3 cache: 9 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-5
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT disabled
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Mitigation; Enhanced IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop
Vulnerability Srbds: Mitigation; Microcode
Vulnerability Tsx async abort: Mitigation; TSX disabled
***CMake***
/home/<user>/.local/bin/cmake
cmake version 3.28.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
***g++***
/usr/bin/g++
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
***nvcc***
/usr/local/cuda/bin/nvcc
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Jun__6_02:18:23_PDT_2024
Cuda compilation tools, release 12.5, V12.5.82
Build cuda_12.5.r12.5/compiler.34385749_0
Thank you @jeanchristopheruel for this report. Can you explain what you are trying to achieve with N = 1 or N = 0 layout?
@milesp-nvidia The issue is for any values of N. It seems to be related to the Tensor constructor of implicit conversion of Tensor Requirements.