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

[WIP] log #147

Merged
merged 11 commits into from
Jul 17, 2017
Merged

[WIP] log #147

merged 11 commits into from
Jul 17, 2017

Conversation

parimarjan
Copy link
Contributor

log implementation.

deepakn94
deepakn94 previously approved these changes May 22, 2017
Copy link
Collaborator

@deepakn94 deepakn94 left a comment

Choose a reason for hiding this comment

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

This looks good -- just the one minor comment!

@@ -1199,7 +1222,9 @@ fn main() {
("iters_for_loop", iters_for_loop),
("serial_parlib_test", serial_parlib_test),
("iters_outofbounds_error_test", iters_outofbounds_error_test),
("outofmemory_error_test", outofmemory_error_test)];
("outofmemory_error_test", outofmemory_error_test),
("simple_log", simple_log)];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add log_error here

erf seems to be giving some linking errors?
@sppalkia sppalkia changed the title log [WIP] log Jun 13, 2017
Copy link
Collaborator

@sppalkia sppalkia left a comment

Choose a reason for hiding this comment

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

Hey Pari,

This looks good overall, but is this with the refactor @deepakn94 had asked about with the Unary Op? That might be a cleaner way of doing this so we don't have so much repeated code among these operators.

@@ -131,6 +132,8 @@ def toWeldFunc(self):
return text

def evaluate(self, restype, verbose=True, decode=True):
print("in evaluate!")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Delete this

let ret_value = compile_and_run(code, conf, &input);
let data = unsafe { weld_value_data(ret_value) as *const f64 };

// fixme: test with a real value
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this test work?

weld/llvm.rs Outdated
@@ -36,6 +36,10 @@ static DICTIONARY_CODE: &'static str = include_str!("resources/dictionary.ll");
static DICTMERGER_CODE: &'static str = include_str!("resources/dictmerger.ll");
static GROUPMERGER_CODE: &'static str = include_str!("resources/groupbuilder.ll");

//fn test(ctx: &mut FunctionContext) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Delete

@@ -92,7 +92,7 @@ fn infer_up(expr: &mut PartialExpr, env: &mut TypeMap) -> WeldResult<bool> {

/// Infer the type of expr or its children locally based on what is known about some of them.
/// Return true if any new expression's type was inferred, or an error if types are inconsistent.
fn infer_locally(expr: &mut PartialExpr, env: &mut TypeMap) -> WeldResult<bool> {
fn infer_locally(mut expr: &mut PartialExpr, env: &mut TypeMap) -> WeldResult<bool> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is the mut necessary here?

Copy link
Collaborator

@sppalkia sppalkia left a comment

Choose a reason for hiding this comment

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

Looks pretty good, very minor comments. I'll just format the whole code base, that'll make the diff cleaner.

@@ -7,6 +7,7 @@
import ctypes

import os
import sys
Copy link
Collaborator

Choose a reason for hiding this comment

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

Delete this

@@ -131,6 +132,7 @@ def toWeldFunc(self):
return text

def evaluate(self, restype, verbose=True, decode=True):
sys.stdout.flush()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Delete

weld/llvm.rs Outdated
)
}

fn unary_op(&mut self, ctx: &mut FunctionContext, func: &SirFunction,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a little weird; maybe just pass the UnaryOpKind into this function and produce the llvm_func here? Otherwise if we add other things which don't have llvm in the function name, it will fail and generate erf

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes that makes sense, thanks! will restructure this like that. I had decomposed this as a separate function when I wasn't using UnaryOp - but I guess maybe now I should just keep everything in gen_func itself?

weld/llvm.rs Outdated
op,
ref child,
} => {
let op_name = try!(llvm_unaryop(op));
Copy link
Collaborator

Choose a reason for hiding this comment

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

See comment above; I think it makes more sense to just merge the functionality of these.

@sppalkia
Copy link
Collaborator

sppalkia commented Jul 1, 2017 via email

Got rid of rustfmt changes, but still need to refactor llvm.rs better.
@sppalkia
Copy link
Collaborator

sppalkia commented Jul 6, 2017

@parimarjan This looks good! I think there's a typo in the code that's causing a compile error, can you fix that? If it passes tests after that I think it's good to go :)

@parimarjan
Copy link
Contributor Author

@sppalkia Pulled in the changes from master, and fixed the compile error. Passes all tests now!

@sppalkia sppalkia merged commit 734053a into weld-project:master Jul 17, 2017
@sppalkia
Copy link
Collaborator

This looks great! I'll merge it in.

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

Successfully merging this pull request may close these issues.

None yet

3 participants