<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - llvm_omp_target_alloc_shared does not allocate memory on device"
href="https://bugs.llvm.org/show_bug.cgi?id=52019">52019</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm_omp_target_alloc_shared does not allocate memory on device
</td>
</tr>
<tr>
<th>Product</th>
<td>OpenMP
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Runtime Library
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>itaru.kitayama@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Below code does not work on an A100 device:
#include <cstdlib>
#include <new>
#include <limits>
#include <iostream>
#include <vector>
#include <omp.h>
#include <array>
extern "C" {
void* llvm_omp_target_alloc_shared(size_t, int);
}
class A {
public:
A();
double get(int slot, int pos) {
return buffer_[slot][pos];
}
std::size_t size() {
return buffer_.size();
}
private:
std::vector<std::array<double,3>> buffer_;
};
A::A()
{
buffer_.reserve(1024);
for (int i=0;i<1024;i++)
buffer_[i].fill(0.1);
}
class B {
public:
int b;
};
int main()
{
A *p = (A*)llvm_omp_target_alloc_shared(sizeof(A), 0);
A *a = new (p) A();
#pragma omp target parallel for
for (auto i=0;i<2;i++) {
printf("%f\n", a->get(i,0));
}
//omp_target_free(a,0);
//free(a);
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>