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

Type unification #147

Closed
its2mc opened this issue Mar 12, 2015 · 5 comments
Closed

Type unification #147

its2mc opened this issue Mar 12, 2015 · 5 comments

Comments

@its2mc
Copy link

its2mc commented Mar 12, 2015

Hey I have the following code
(module
(define (main)
(let ((x (vector 1 2))
(y (vector 3 4)))
(let ((z (kernel ((i x))
(kernel ((j y))
(+ i (+ j (+ 2 3)))))))
(println "The resultant matrix is ")
(println z)))
0))

I would like to add in some text with the variable as an output. While the above code compiles, the runtime error is

*** glibc detected *** ./addition-test-2: double free or corruption (out): 0x000000000303eca0 ***

before I tried using (println "The resultant matrix is " z) but it gave me this error:

In expression...
(invoke (var z_22))
Expected type...
(closure
##{rvar cb26eek7jwtius46vhva6e-215} invoke_53
->
#[#{tvar cb26eek7jwtius46vhva6e-216} invoke_52])
But found...
(vec #[#{rvar cb26eek7jwtius46vhva6e-215} rk_51](vec #[#{rvar cb26eek7jwtius46vhva6e-215} rk_50]
#[#{tvar cb26eek7jwtius46vhva6e-216} num_49]))
Exception in typecheck: Could not unify types

Is there a way to unify different data types?

@eholk
Copy link
Owner

eholk commented Mar 16, 2015

Huh, the double free corruption is a problem. I'll have to investigate a little further.

As far as the second thing goes, try using (println* "The resultant matrix is " z). println is only supports to take one argument (although it supports a second optional argument to tell it where to print the thing, such as to a file). println* is a version that can take any number of things and print them together.

@eholk
Copy link
Owner

eholk commented Apr 21, 2015

I just tried running this program and got the following output:

OpenCL Platform Name:    Apple
OpenCL Platform Vendor:  Apple
OpenCL Platform Version: OpenCL 1.2 (Dec 14 2014 22:29:47)
found 2 devices
Creating queue for Intel(R) Core(TM) i5-2500S CPU @ 2.70GHz
The resultant matrix is 
[[9 10] 
 [10 11]]
JITTIME: 0.000159595

I didn't see any double free or corruption error. What system are you running on?

@its2mc
Copy link
Author

its2mc commented Apr 22, 2015

Hey I tried it again and this is what I got

OpenCL Platform Name: AMD Accelerated Parallel Processing
OpenCL Platform Vendor: Advanced Micro Devices, Inc.
OpenCL Platform Version: OpenCL 2.0 AMD-APP (1642.5)
found 4 devices
Creating queue for Tahiti
The resultant matrix is
[[9 10]
[10 11]]
JITTIME: 0.020481752
*** glibc detected *** ./mine: free(): invalid next size (fast): 0x00000000014e4 2b0 ***

I am not sure what conditions resulted in the first error since I did it a while ago. but it seems to be working now.. However what does glibc detected mean? and also is it possible to have the memory map and backtrace info optional?

@eholk
Copy link
Owner

eholk commented Apr 22, 2015

Ah, this actually looks like the same error. *** glibc detected *** means
this was an error in that glibc found in its memory allocator. It looks
like we may be using memory after freeing, or something like that.

On Wed, Apr 22, 2015 at 6:12 AM Phillip Ochola [email protected]
wrote:

Hey I tried it again and this is what I got

OpenCL Platform Name: AMD Accelerated Parallel Processing
OpenCL Platform Vendor: Advanced Micro Devices, Inc.
OpenCL Platform Version: OpenCL 2.0 AMD-APP (1642.5)
found 4 devices
Creating queue for Tahiti
The resultant matrix is
[[9 10]
[10 11]]
JITTIME: 0.020481752
*** glibc detected *** ./mine: free(): invalid next size (fast):
0x00000000014e4 2b0 ***

I am not sure what conditions resulted in the first error since I did it a
while ago. but it seems to be working now.. However what does glibc
detected mean? and also is it possible to have the memory map and backtrace
info optional?


Reply to this email directly or view it on GitHub
#147 (comment).

@eholk
Copy link
Owner

eholk commented Apr 28, 2015

I opened #150 to focus on the memory corruption problems, since I'm starting to see it on my own now too.

I'm going to close this issue, since it seems like we figured out the type unification part of it. Feel free to reopen if this is not correct.

@eholk eholk closed this as completed Apr 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants