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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with the ampere example #61

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions include/cutlass/cutlass.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@
#pragma once

#include "cutlass/detail/helper_macros.hpp"

#if defined(CUTLASS_ENABLE_SYCL)
#include "syclcompat.hpp"
#endif

#include <cutlass/gpu_generics.h>

////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 5 additions & 0 deletions include/cutlass/gpu_generics.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
* frameworks such as CUDA and SYCL.
*/

#if defined(CUTLASS_ENABLE_SYCL)
#include <sycl/sycl.hpp>
#include <syclcompat.hpp>
#endif

////////////////////////////////////////////////////////////////////////////////////////////////////

static const int NumThreadsPerWarp = 32;
Expand Down
8 changes: 4 additions & 4 deletions include/cutlass/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -7825,7 +7825,7 @@ struct Matrix<Element_, 3, 3> {

Matrix m;

m.set_slice3x3({
m.set_slice_3x3({
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a bug. set_slice3x3 is not defined anywhere in the code.

c + x * x * one_minus_cos, x * y * one_minus_cos - z * s, x * z * one_minus_cos + y * s,
y * x * one_minus_cos * z * s, c + y * y * one_minus_cos, y * z * one_minus_cos - x * s,
z * x * one_minus_cos - y * s, z * y * one_minus_cos + x * s, c + z * z * one_minus_cos
Expand All @@ -7845,7 +7845,7 @@ struct Matrix<Element_, 3, 3> {

Matrix m = Matrix::identity();

m.set_slice3x3({
m.set_slice_3x3({
Element(1) - Element(2) * a * a, Element(-2) * a * b, Element(-2) * a * c,
Element(-2) * a * b, Element(1) - Element(2) * b * b, Element(-2) * b * c,
Element(-2) * a * c, Element(-2) * b * c, Element(1) - Element(2) * c * c
Expand Down Expand Up @@ -14005,7 +14005,7 @@ struct Matrix<Element_, 4, 4> {

Matrix m;

m.set_slice3x3({
m.set_slice_3x3({
c + x * x * one_minus_cos, x * y * one_minus_cos - z * s, x * z * one_minus_cos + y * s,
y * x * one_minus_cos * z * s, c + y * y * one_minus_cos, y * z * one_minus_cos - x * s,
z * x * one_minus_cos - y * s, z * y * one_minus_cos + x * s, c + z * z * one_minus_cos
Expand All @@ -14025,7 +14025,7 @@ struct Matrix<Element_, 4, 4> {

Matrix m = Matrix::identity();

m.set_slice3x3({
m.set_slice_3x3({
Element(1) - Element(2) * a * a, Element(-2) * a * b, Element(-2) * a * c,
Element(-2) * a * b, Element(1) - Element(2) * b * b, Element(-2) * b * c,
Element(-2) * a * c, Element(-2) * b * c, Element(1) - Element(2) * c * c
Expand Down
11 changes: 6 additions & 5 deletions tools/util/include/cutlass/util/device_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ T* allocate(size_t count = 1) {
T* ptr = 0;

#if defined(CUTLASS_ENABLE_SYCL)
ptr = syclcompat::malloc<T>(count);
if (ptr == nullptr) {
throw std::runtime_error("Failed to allocate memory");
if (count > 0) {
ptr = reinterpret_cast<T*>(syclcompat::malloc(bytes));
if ((void*)ptr == nullptr) {
throw std::runtime_error("Failed to allocate memory");
}
}
#else
size_t bytes = 0;

bytes = count * sizeof(T);

cudaError_t cuda_error = cudaMalloc((void**)&ptr, bytes);
Expand All @@ -78,7 +79,7 @@ T* allocate(size_t count = 1) {
template <typename T>
void free(T* ptr) {
#if defined(CUTLASS_ENABLE_SYCL)
syclcompat::free((void*)ptr);
syclcompat::free(ptr);
if (ptr != nullptr) {
throw std::runtime_error("Failed to free device memory");
}
Expand Down