# HG changeset patch # User Thomas Wuerthinger # Date 1381066700 -7200 # Node ID 1ec42a9f61499a4c4c55a8478483dadedf5ac20d # Parent f753092f608dae121f362cf95bb323d2afedd713# Parent 280f97f13d54b779d3a5c36def6b64b8c3b163bc Merge. diff -r f753092f608d -r 1ec42a9f6149 graal/com.oracle.graal.asm.ptx/src/com/oracle/graal/asm/ptx/PTXAssembler.java --- a/graal/com.oracle.graal.asm.ptx/src/com/oracle/graal/asm/ptx/PTXAssembler.java Sun Oct 06 15:36:12 2013 +0200 +++ b/graal/com.oracle.graal.asm.ptx/src/com/oracle/graal/asm/ptx/PTXAssembler.java Sun Oct 06 15:38:20 2013 +0200 @@ -185,7 +185,7 @@ assert v != null; if (isConstant(v)) { - return (emitConstant(v)); + return (emitConstant(v, comma)); } else { return (emitRegister((Variable) v, comma)); } @@ -195,21 +195,31 @@ return (" %r" + v.index + (comma ? "," : "")); } - public String emitConstant(Value v) { + public String emitConstant(Value v, boolean comma) { Constant constant = (Constant) v; + String str = null; switch (v.getKind().getTypeChar()) { case 'i': - return (String.valueOf((int) constant.asLong())); + str = String.valueOf((int) constant.asLong()); + break; case 'f': - return (String.valueOf(constant.asFloat())); + str = String.valueOf(constant.asFloat()); + break; case 'j': - return (String.valueOf(constant.asLong())); + str = String.valueOf(constant.asLong()); + break; case 'd': - return (String.valueOf(constant.asDouble())); + str = String.valueOf(constant.asDouble()); + break; default: throw GraalInternalError.shouldNotReachHere(); } + if (comma) { + return (str + ","); + } else { + return str; + } } } @@ -298,6 +308,27 @@ } } + public static class BinarySingleOperandFormat extends SingleOperandFormat { + + public BinarySingleOperandFormat(Variable dst, Value src) { + super(dst, src); + } + + @Override + public String typeForKind(Kind k) { + switch (k.getTypeChar()) { + case 's': + return "b16"; + case 'i': + return "b32"; + case 'j': + return "b64"; + default: + throw GraalInternalError.shouldNotReachHere(); + } + } + } + public static class ConversionFormat extends SingleOperandFormat { public ConversionFormat(Variable dst, Value src) { @@ -480,7 +511,10 @@ // Checkstyle: stop method name check public final void bra(String tgt, int pred) { - emitString((pred >= 0) ? "" : ("@%p" + pred + " ") + "bra" + " " + tgt + ";" + ""); + System.err.println("BRA: " + tgt + " pred: " + pred); + assert pred >= 0; + + emitString("@%p" + pred + " " + "bra" + " " + tgt + ";"); } public final void bra_uni(String tgt) { @@ -526,7 +560,7 @@ } } - public static class Not extends SingleOperandFormat { + public static class Not extends BinarySingleOperandFormat { public Not(Variable dst, Variable src) { super(dst, src); @@ -581,8 +615,33 @@ } public void emit(PTXAssembler asm) { - asm.emitString(".param ." + typeForKind(dest.getKind()) + emitParameter(dest) + (lastParameter ? "" : ",")); + asm.emitString(".param ." + paramForKind(dest.getKind()) + emitParameter(dest) + (lastParameter ? "" : ",")); } + + public String paramForKind(Kind k) { + switch (k.getTypeChar()) { + case 'z': + case 'f': + return "s32"; + case 'b': + return "s8"; + case 's': + return "s16"; + case 'c': + return "u16"; + case 'i': + return "s32"; + case 'j': + return "s64"; + case 'd': + return "f64"; + case 'a': + return "u64"; + default: + throw GraalInternalError.shouldNotReachHere(); + } + } + } public final void popc_b32(Register d, Register a) { diff -r f753092f608d -r 1ec42a9f6149 graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/ArrayPTXTest.java --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/ArrayPTXTest.java Sun Oct 06 15:36:12 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/ArrayPTXTest.java Sun Oct 06 15:38:20 2013 +0200 @@ -71,12 +71,6 @@ } - public static void printReport(String message) { - // CheckStyle: stop system..print check - System.out.println(message); - // CheckStyle: resume system..print check - } - public static void main(String[] args) { ArrayPTXTest test = new ArrayPTXTest(); for (Method m : ArrayPTXTest.class.getMethods()) { diff -r f753092f608d -r 1ec42a9f6149 graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java Sun Oct 06 15:36:12 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java Sun Oct 06 15:38:20 2013 +0200 @@ -30,7 +30,6 @@ /** * Test class for small Java methods compiled to PTX kernels. */ -@Ignore public class BasicPTXTest extends PTXTestBase { @Test diff -r f753092f608d -r 1ec42a9f6149 graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/ControlPTXTest.java --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/ControlPTXTest.java Sun Oct 06 15:36:12 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/ControlPTXTest.java Sun Oct 06 15:38:20 2013 +0200 @@ -28,13 +28,23 @@ public class ControlPTXTest extends PTXTestBase { - @Ignore @Test public void testControl() { - compile("testLoop"); + Integer ret = (Integer) invoke(compile("testLoop"), 42); + if (ret != null) { + printReport("testLoop: " + ret); + } else { + printReport("testLoop: no VALUE"); + } + ret = (Integer) invoke(compile("testSwitchDefault1I"), 3); + if (ret != null) { + printReport("testSwitchDefault1I: " + ret); + } else { + printReport("testSwitchDefault1I: no VALUE"); + } + compile("testStatic"); + compile("testCall"); // compile("testSwitch1I"); - // compile("testStatic"); - // compile("testCall"); // compile("testLookupSwitch1I"); } @@ -47,6 +57,13 @@ return sum; } + public static int testSwitchDefault1I(int a) { + switch (a) { + default: + return 4; + } + } + public static int testSwitch1I(int a) { switch (a) { case 1: @@ -100,7 +117,7 @@ return a + b; } - public static int testCall(@SuppressWarnings("unused") Object o, int a, int b) { + public static int testCall(int a, int b) { return method(a, b); } diff -r f753092f608d -r 1ec42a9f6149 graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/FloatPTXTest.java --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/FloatPTXTest.java Sun Oct 06 15:36:12 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/FloatPTXTest.java Sun Oct 06 15:38:20 2013 +0200 @@ -29,7 +29,6 @@ import com.oracle.graal.api.code.CompilationResult; /* PTX ISA 3.1 - 8.7.3 Floating-Point Instructions */ -@Ignore public class FloatPTXTest extends PTXTestBase { @Ignore @@ -359,13 +358,6 @@ return (float) a; } - public static void printReport(String message) { - // CheckStyle: stop system..print check - System.out.println(message); - // CheckStyle: resume system..print check - - } - public static void main(String[] args) { FloatPTXTest test = new FloatPTXTest(); for (Method m : FloatPTXTest.class.getMethods()) { diff -r f753092f608d -r 1ec42a9f6149 graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/IntegerPTXTest.java --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/IntegerPTXTest.java Sun Oct 06 15:36:12 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/IntegerPTXTest.java Sun Oct 06 15:38:20 2013 +0200 @@ -30,8 +30,8 @@ @Test public void testAdd() { - /* - Integer r4 = (Integer) invoke(compile("testAdd2B"), (byte) 6, (byte) 4); + + /* Integer r4 = (Integer) invoke(compile("testAdd2B"), (byte) 6, (byte) 4); if (r4 == null) { printReport("testAdd2B FAILED"); } else if (r4.intValue() == testAdd2B((byte) 6, (byte) 4)) { @@ -49,14 +49,14 @@ printReport("testAdd2I FAILED"); } - /* Long r2 = (Long) invoke(compile("testAdd2L"), (long) 12, (long) 6); + Long r2 = (Long) invoke(compile("testAdd2L"), (long) 12, (long) 6); if (r2 == null) { printReport("testAdd2L FAILED"); } else if (r2.longValue() == testAdd2L(12, 6)) { printReport("testAdd2L PASSED"); } else { printReport("testAdd2L FAILED"); - } + } r4 = (Integer) invoke(compile("testAddIConst"), 5); if (r4 == null) { @@ -74,7 +74,7 @@ printReport("testAddConstI PASSED"); } else { printReport("testAddConstI FAILED"); - } */ + } } public static int testAdd2I(int a, int b) { @@ -97,7 +97,6 @@ return 32 + a; } - @Ignore @Test public void testSub() { @@ -155,7 +154,6 @@ return 32 - a; } - @Ignore @Test public void testMul() { @@ -348,12 +346,6 @@ return (int) a; } - public static void printReport(String message) { - // CheckStyle: stop system..print check - System.out.println(message); - // CheckStyle: resume system..print check - - } public static void main(String[] args) { IntegerPTXTest test = new IntegerPTXTest(); diff -r f753092f608d -r 1ec42a9f6149 graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/LogicPTXTest.java --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/LogicPTXTest.java Sun Oct 06 15:36:12 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/LogicPTXTest.java Sun Oct 06 15:38:20 2013 +0200 @@ -24,11 +24,9 @@ import java.lang.reflect.Method; -import org.junit.Ignore; import org.junit.Test; /* PTX ISA 3.1 - 8.7.5 Logic and Shift Instructions */ -@Ignore public class LogicPTXTest extends PTXTestBase { @Test diff -r f753092f608d -r 1ec42a9f6149 graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java Sun Oct 06 15:36:12 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java Sun Oct 06 15:38:20 2013 +0200 @@ -55,6 +55,13 @@ private StructuredGraph sg; + public void printReport(String message) { + // CheckStyle: stop system..print check + System.out.println(message); + // CheckStyle: resume system..print check + + } + protected CompilationResult compile(String test) { if (runtime instanceof PTXHotSpotRuntime) { StructuredGraph graph = parse(test); diff -r f753092f608d -r 1ec42a9f6149 graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java --- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Sun Oct 06 15:36:12 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Sun Oct 06 15:38:20 2013 +0200 @@ -765,10 +765,10 @@ // Making a copy of the switch value is necessary because jump table destroys the input // value if (key.getKind() == Kind.Int || key.getKind() == Kind.Long) { - append(new SequentialSwitchOp(keyConstants, keyTargets, defaultTarget, key, Value.ILLEGAL, nextPredRegNum)); + append(new SequentialSwitchOp(keyConstants, keyTargets, defaultTarget, key, Value.ILLEGAL, nextPredRegNum++)); } else { assert key.getKind() == Kind.Object : key.getKind(); - append(new SequentialSwitchOp(keyConstants, keyTargets, defaultTarget, key, newVariable(Kind.Object), nextPredRegNum)); + append(new SequentialSwitchOp(keyConstants, keyTargets, defaultTarget, key, newVariable(Kind.Object), nextPredRegNum++)); } } diff -r f753092f608d -r 1ec42a9f6149 graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXControlFlow.java --- a/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXControlFlow.java Sun Oct 06 15:36:12 2013 +0200 +++ b/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXControlFlow.java Sun Oct 06 15:38:20 2013 +0200 @@ -230,7 +230,9 @@ } @SuppressWarnings("unused") - private static void tableswitch(TargetMethodAssembler tasm, PTXAssembler masm, int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value value, Value scratch, int predNum) { + private static void tableswitch(TargetMethodAssembler tasm, PTXAssembler masm, int lowKey, + LabelRef defaultTarget, LabelRef[] targets, + Value value, Value scratch, int predNum) { Buffer buf = masm.codeBuffer; // Compare index against jump table bounds int highKey = lowKey + targets.length - 1; diff -r f753092f608d -r 1ec42a9f6149 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java Sun Oct 06 15:36:12 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java Sun Oct 06 15:38:20 2013 +0200 @@ -350,6 +350,7 @@ // Math.pow(value, 13); } + @Ignore @Test public void testIntegerSubstitutions() { assertInGraph(test("integerReverseBytes"), ReverseBytesNode.class); // Java @@ -385,6 +386,7 @@ return Integer.bitCount(value); } + @Ignore @Test public void testLongSubstitutions() { assertInGraph(test("longReverseBytes"), ReverseBytesNode.class); // Java diff -r f753092f608d -r 1ec42a9f6149 src/gpu/ptx/vm/gpu_ptx.cpp --- a/src/gpu/ptx/vm/gpu_ptx.cpp Sun Oct 06 15:36:12 2013 +0200 +++ b/src/gpu/ptx/vm/gpu_ptx.cpp Sun Oct 06 15:38:20 2013 +0200 @@ -180,9 +180,58 @@ int total = nmp * ncores(major, minor); + int max_threads_per_block, warp_size, async_engines, can_map_host_memory, concurrent_kernels; + + status = _cuda_cu_device_get_attribute(&max_threads_per_block, + GRAAL_CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK, + _cu_device); + + if (status != GRAAL_CUDA_SUCCESS) { + tty->print_cr("[CUDA] Failed to get GRAAL_CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK: %d", _cu_device); + return 0; + } + + status = _cuda_cu_device_get_attribute(&warp_size, + GRAAL_CU_DEVICE_ATTRIBUTE_WARP_SIZE, + _cu_device); + + if (status != GRAAL_CUDA_SUCCESS) { + tty->print_cr("[CUDA] Failed to get GRAAL_CU_DEVICE_ATTRIBUTE_WARP_SIZE: %d", _cu_device); + return 0; + } + + status = _cuda_cu_device_get_attribute(&async_engines, + GRAAL_CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT, + _cu_device); + + if (status != GRAAL_CUDA_SUCCESS) { + tty->print_cr("[CUDA] Failed to get GRAAL_CU_DEVICE_ATTRIBUTE_WARP_SIZE: %d", _cu_device); + return 0; + } + + status = _cuda_cu_device_get_attribute(&can_map_host_memory, + GRAAL_CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY, + _cu_device); + + if (status != GRAAL_CUDA_SUCCESS) { + tty->print_cr("[CUDA] Failed to get GRAAL_CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY: %d", _cu_device); + return 0; + } + + status = _cuda_cu_device_get_attribute(&concurrent_kernels, + GRAAL_CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS, + _cu_device); + + if (status != GRAAL_CUDA_SUCCESS) { + tty->print_cr("[CUDA] Failed to get GRAAL_CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS: %d", _cu_device); + return 0; + } + if (TraceGPUInteraction) { tty->print_cr("[CUDA] Compatibility version of device %d: %d.%d", _cu_device, major, minor); - tty->print_cr("[CUDA] Number of cores: %d", total); + tty->print_cr("[CUDA] Number of cores: %d async engines: %d can map host mem: %d concurrent kernels: %d", + total, async_engines, can_map_host_memory, concurrent_kernels); + tty->print_cr("[CUDA] Max threads per block: %d warp size: %d", max_threads_per_block, warp_size); } return (total); @@ -344,6 +393,17 @@ ret.set_jint(return_val); } break; + case T_FLOAT: + { + float return_val; + status = gpu::Ptx::_cuda_cu_memcpy_dtoh(&return_val, ptxka._return_value_ptr, T_FLOAT_BYTE_SIZE); + if (status != GRAAL_CUDA_SUCCESS) { + tty->print_cr("[CUDA] *** Error (%d) Failed to copy value to device argument", status); + return false; + } + ret.set_jfloat(return_val); + } + break; case T_LONG: { long return_val; diff -r f753092f608d -r 1ec42a9f6149 src/gpu/ptx/vm/gpu_ptx.hpp --- a/src/gpu/ptx/vm/gpu_ptx.hpp Sun Oct 06 15:36:12 2013 +0200 +++ b/src/gpu/ptx/vm/gpu_ptx.hpp Sun Oct 06 15:38:20 2013 +0200 @@ -31,10 +31,15 @@ */ #define GRAAL_CUDA_SUCCESS 0 /**< Device shares a unified address space with the host */ +#define GRAAL_CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK 1 #define GRAAL_CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING 41 #define GRAAL_CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR 75 #define GRAAL_CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR 76 #define GRAAL_CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT 16 +#define GRAAL_CU_DEVICE_ATTRIBUTE_WARP_SIZE 10 +#define GRAAL_CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY 19 +#define GRAAL_CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS 31 +#define GRAAL_CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT 40 #define GRAAL_CU_JIT_MAX_REGISTERS 0 #define GRAAL_CU_JIT_THREADS_PER_BLOCK 1 #define GRAAL_CU_JIT_INFO_LOG_BUFFER 3 diff -r f753092f608d -r 1ec42a9f6149 src/gpu/ptx/vm/ptxKernelArguments.cpp --- a/src/gpu/ptx/vm/ptxKernelArguments.cpp Sun Oct 06 15:36:12 2013 +0200 +++ b/src/gpu/ptx/vm/ptxKernelArguments.cpp Sun Oct 06 15:38:20 2013 +0200 @@ -41,35 +41,67 @@ } void PTXKernelArguments::do_int() { - if (is_after_invocation()) { - return; - } - // If the parameter is a return value, - if (is_return_type()) { - // Allocate device memory for T_INT return value pointer on device. Size in bytes - int status = gpu::Ptx::_cuda_cu_memalloc(&_return_value_ptr, T_INT_BYTE_SIZE); - if (status != GRAAL_CUDA_SUCCESS) { - tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for return value pointer on device", status); - _success = false; - return; + if (is_after_invocation()) { + return; + } + // If the parameter is a return value, + if (is_return_type()) { + // Allocate device memory for T_INT return value pointer on device. Size in bytes + int status = gpu::Ptx::_cuda_cu_memalloc(&_return_value_ptr, T_INT_BYTE_SIZE); + if (status != GRAAL_CUDA_SUCCESS) { + tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for return value pointer on device", status); + _success = false; + return; + } + // Push _return_value_ptr to _kernelBuffer + *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = _return_value_ptr; + _bufferOffset += sizeof(_return_value_ptr); + } else { + // Get the next java argument and its value which should be a T_INT + oop arg = next_arg(T_INT); + // Copy the java argument value to kernelArgBuffer + jvalue intval; + if (java_lang_boxing_object::get_value(arg, &intval) != T_INT) { + tty->print_cr("[CUDA] *** Error: Unexpected argument type; expecting T_INT"); + _success = false; + return; + } + *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = intval.i; + _bufferOffset += sizeof(intval.i); } - // Push _return_value_ptr to _kernelBuffer - *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = _return_value_ptr; - _bufferOffset += sizeof(_return_value_ptr); - } else { - // Get the next java argument and its value which should be a T_INT - oop arg = next_arg(T_INT); - // Copy the java argument value to kernelArgBuffer - jvalue intval; - if (java_lang_boxing_object::get_value(arg, &intval) != T_INT) { - tty->print_cr("[CUDA] *** Error: Unexpected argument type; expecting T_INT"); - _success = false; - return; + return; +} + +void PTXKernelArguments::do_float() { + if (is_after_invocation()) { + return; } - *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = intval.i; - _bufferOffset += sizeof(intval.i); - } - return; + // If the parameter is a return value, + if (is_return_type()) { + // Allocate device memory for T_INT return value pointer on device. Size in bytes + int status = gpu::Ptx::_cuda_cu_memalloc(&_return_value_ptr, T_FLOAT_BYTE_SIZE); + if (status != GRAAL_CUDA_SUCCESS) { + tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for return value pointer on device", status); + _success = false; + return; + } + // Push _return_value_ptr to _kernelBuffer + *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = _return_value_ptr; + _bufferOffset += sizeof(_return_value_ptr); + } else { + // Get the next java argument and its value which should be a T_INT + oop arg = next_arg(T_FLOAT); + // Copy the java argument value to kernelArgBuffer + jvalue floatval; + if (java_lang_boxing_object::get_value(arg, &floatval) != T_FLOAT) { + tty->print_cr("[CUDA] *** Error: Unexpected argument type; expecting T_INT"); + _success = false; + return; + } + *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = floatval.f; + _bufferOffset += sizeof(floatval.f); + } + return; } void PTXKernelArguments::do_long() { diff -r f753092f608d -r 1ec42a9f6149 src/gpu/ptx/vm/ptxKernelArguments.hpp --- a/src/gpu/ptx/vm/ptxKernelArguments.hpp Sun Oct 06 15:36:12 2013 +0200 +++ b/src/gpu/ptx/vm/ptxKernelArguments.hpp Sun Oct 06 15:38:20 2013 +0200 @@ -30,6 +30,7 @@ #define T_BYTE_SIZE 1 #define T_INT_BYTE_SIZE 4 +#define T_FLOAT_BYTE_SIZE 4 #define T_LONG_BYTE_SIZE 8 #define T_ARRAY_BYTE_SIZE 8 @@ -99,6 +100,7 @@ void do_byte(); void do_int(); + void do_float(); void do_long(); void do_array(int begin, int end); void do_void(); @@ -115,10 +117,6 @@ /* TODO : To be implemented */ guarantee(false, "do_short:NYI"); } - inline void do_float() { - /* TODO : To be implemented */ - guarantee(false, "do_float:NYI"); - } inline void do_double() { /* TODO : To be implemented */ guarantee(false, "do_double:NYI");