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

An "expected an expression" error in compiled CUDA code. #318

Closed
LukaHorvat opened this issue May 24, 2016 · 5 comments
Closed

An "expected an expression" error in compiled CUDA code. #318

LukaHorvat opened this issue May 24, 2016 · 5 comments
Labels

Comments

@LukaHorvat
Copy link

I have the following Haskell function

mod'' :: Exp Double -> Exp Double -> Exp Double
mod'' x y = x - (fromIntegral (round (x / y) :: Exp Int) * y)

(never mind what it does).

This gets compiled to something like

const double v38 = lv214 + ({ const double v35 = 1.23456789e8 * lv214;  ; v35 - 2.0 * (double) (Int64) round(v35 / 2.0); }) * lv24;

which is apparently an error.

@tmcdonell
Copy link
Member

What is the error message? What version of ghc/gcc/nvcc etc. are you using? Are you on windows/linux/mac? Some information to help diagnose and work out the problem would be useful here...

@LukaHorvat
Copy link
Author

You're right. Sorry. The error is the one in the title. Just that.

I'm running GHC 7.10.3 on Windows. GCC is the one that comes with that
version of GHC.

I'll check the nvcc version when I get home.

On Wed, May 25, 2016, 3:18 AM Trevor L. McDonell notifications@github.com
wrote:

What is the error message? What version of ghc/gcc/nvcc etc. are you
using? Are you on windows/linux/mac? Some information to help diagnose and
work out the problem would be useful here...


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#318 (comment)

@LukaHorvat
Copy link
Author

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:49:10_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17

@tmcdonell
Copy link
Member

I suspected that you were using windows. The problem is that MSVC does not support statement expressions. We discussed this in #234, and @mwu-tow has a fix there that should also work for you.

It might be worthwhile trying to merge that fix into accelerate-cuda (I think the necessary changes to language-c-quote eventually made it in) I will just have to reacquaint myself with everything that was discussed etc. The long term plan is probably to just transition everybody to the LLVM backends, where this problem doesn't exist.

@tmcdonell tmcdonell mentioned this issue Jan 28, 2017
@tmcdonell tmcdonell added the cuda backend [deprecated] label Jun 26, 2017
@tmcdonell
Copy link
Member

closing as the accelerate-cuda backend is deprecated and accelerate-llvm-ptx should work in windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants