Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent results when running torch.nn.functional.embedding_bag on CPU (1.12.0, 1.13.0) #107432

Open
dmc1778 opened this issue Aug 18, 2023 · 2 comments
Assignees
Labels
module: cpu CPU specific problem (e.g., perf, algorithm) module: embedding triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@dmc1778
Copy link

dmc1778 commented Aug 18, 2023

馃悰 Describe the bug

I get the results on GPU, but now results on CPU.

results = dict()
import torch
arg_1_tensor = torch.rand([10, 3], dtype=torch.float64)
arg_1 = arg_1_tensor.clone()
arg_2_tensor = torch.randint(-128,64,[8], dtype=torch.int64)
arg_2 = arg_2_tensor.clone()
arg_3_tensor = torch.tensor([1], dtype=torch.bool)
arg_3 = arg_3_tensor.clone()
arg_4 = True
try:
  results["res_cpu"] = torch.nn.functional.embedding_bag(arg_1,arg_2,arg_3,sparse=arg_4,)
except Exception as e:
  print("Error:"+str(e))
arg_1 = arg_1_tensor.clone().cuda()
arg_2 = arg_2_tensor.clone().cuda()
arg_3 = arg_3_tensor.clone().cuda()
try:
  results["res_gpu"] = torch.nn.functional.embedding_bag(arg_1,arg_2,arg_3,sparse=arg_4,)
except Exception as e:
  print("Error:"+str(e))

print(results)

Output on GPU:

 tensor([[0.0217, 0.1224, 0.0373]], device='cuda:0', dtype=torch.float64)

On the CPU, the output is empty.

Versions

PyTorch version: 1.12.0
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.2 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.16 (main, May 15 2023, 23:46:34)  [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.2.0-26-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: 
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 535.86.05
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

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):                          16
On-line CPU(s) list:             0-15
Vendor ID:                       GenuineIntel
Model name:                      Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz
CPU family:                      6
Model:                           165
Thread(s) per core:              2
Core(s) per socket:              8
Socket(s):                       1
Stepping:                        5
CPU max MHz:                     4800.0000
CPU min MHz:                     800.0000
BogoMIPS:                        5799.77
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 invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust sgx 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 pku ospke sgx_lc md_clear flush_l1d arch_capabilities
Virtualization:                  VT-x
L1d cache:                       256 KiB (8 instances)
L1i cache:                       256 KiB (8 instances)
L2 cache:                        2 MiB (8 instances)
L3 cache:                        16 MiB (1 instance)
NUMA node(s):                    1
NUMA node0 CPU(s):               0-15
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 vulnerable
Vulnerability Retbleed:          Mitigation; Enhanced IBRS
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 IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:             Mitigation; Microcode
Vulnerability Tsx async abort:   Not affected

Versions of relevant libraries:
[pip3] numpy==1.25.0
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas                      1.0                         mkl  
[conda] cudatoolkit               10.2.89              hfd86e86_1  
[conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
[conda] mkl                       2023.1.0         h6d00ec8_46342  
[conda] mkl-service               2.4.0            py39h5eee18b_1  
[conda] mkl_fft                   1.3.6            py39h417a72b_1  
[conda] mkl_random                1.2.2            py39h417a72b_1  
[conda] numpy                     1.25.0           py39h5f9d8c6_0  
[conda] numpy-base                1.25.0           py39hb5e798b_0  
[conda] pytorch                   1.12.0          py3.9_cuda10.2_cudnn7.6.5_0    pytorch
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] torchaudio                0.12.0               py39_cu102    pytorch
[conda] torchvision               0.13.0               py39_cu102    pytorch

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10

@mingfeima
Copy link
Collaborator

@zhuhaozhe could you please help fix this one ?

@ezyang ezyang added module: cpu CPU specific problem (e.g., perf, algorithm) triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module module: embedding labels Aug 18, 2023
@dmc1778 dmc1778 changed the title Inconsistent results when running torch.nn.functional.embedding_bag on CPU Inconsistent results when running torch.nn.functional.embedding_bag on CPU (1.12.0, 1.13.0) Aug 19, 2023
@zhuhaozhe
Copy link
Collaborator

@zhuhaozhe could you please help fix this one ?

@mingfeima yes

zhuhaozhe added a commit that referenced this issue Aug 29, 2023
zhuhaozhe added a commit that referenced this issue Aug 29, 2023
zhuhaozhe added a commit that referenced this issue Aug 29, 2023
zhuhaozhe added a commit that referenced this issue Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: cpu CPU specific problem (e.g., perf, algorithm) module: embedding triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
Status: No status
Development

No branches or pull requests

4 participants