Skip to content

Commit 32003dd

Browse files
author
Gary Frost
committed
Fixes for cuda codegen issues
1 parent 4cd871e commit 32003dd

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaBackend.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ public void computeContextHandoff(ComputeContext computeContext) {
377377
@Override
378378
public void dispatchKernel(KernelCallGraph kernelCallGraph, NDRange ndRange, Object... args) {
379379
CompiledKernel compiledKernel = kernelCallGraphCompiledCodeMap.computeIfAbsent(kernelCallGraph, (_) -> {
380-
String code = config.isPTX() ? createPTX(kernelCallGraph, ndRange, args) : createC99(kernelCallGraph, ndRange, args);
380+
String code = config.isPTX() ? createPTX(kernelCallGraph, args) : createC99(kernelCallGraph, ndRange, args);
381381
if (config.isSHOW_CODE()) {
382382
System.out.println(code);
383383
}

hat/backends/ffi/cuda/src/main/java/hat/backend/ffi/CudaHATKernelBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private CudaHATKernelBuilder threadDimId(int id) {
5656

5757
@Override
5858
public CudaHATKernelBuilder globalId(int id) {
59-
return blockId(id).asterisk().localSize(id).plus().localId(id);
59+
return paren(_->blockId(id).asterisk().localSize(id).plus().localId(id));
6060
}
6161

6262
@Override

hat/core/src/main/java/hat/BufferTagger.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
/*
2+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
126
package hat;
227

328
import hat.buffer.Buffer;

hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@
3838
import java.util.function.Consumer;
3939

4040
public abstract class C99HATKernelBuilder<T extends C99HATKernelBuilder<T>> extends HATCodeBuilderWithContext<T> {
41-
// protected final NDRange ndRange; // Should be in the context ?
42-
// public C99HATKernelBuilder(NDRange ndRange) {
43-
// this.ndRange = ndRange;
44-
// }
4541
public T types() {
4642
return this
4743
.charTypeDefs("byte", "boolean")

0 commit comments

Comments
 (0)