Skip to content

Commit

Permalink
Rename llvm -> llvm2 to fix codegen segfault (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
sppalkia authored May 17, 2019
1 parent 1262966 commit eb5c1cb
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 39 deletions.
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,3 @@ members = [
"weld-repl",
"weld-hdrgen"
]

# HotFix for compilation failure...
[profile.release]
opt-level = 0
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

[Documentation](https://www.weld.rs/docs/latest/weld/)

**Note: due to an apparent issue with `rustc`, `cargo build --release` with the defaults was causing a segmentation fault on MacOS. Optimizations with release builds have thus been disabled until this issue is resolved.**

Weld is a language and runtime for improving the performance of data-intensive applications. It optimizes across libraries and functions by expressing the core computations in libraries using a common intermediate representation, and optimizing across each framework.

Modern analytics applications combine multiple functions from different libraries and frameworks to build complex workflows. Even though individual functions can achieve high performance in isolation, the performance of the combined workflow is often an order of magnitude below hardware limits due to extensive data movement across the functions. Weld’s take on solving this problem is to lazily build up a computation for the entire workflow, and then optimizing and evaluating it only when a result is needed.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Code generation for the appender builder type.
//!
//! Much of this code mirrors the implementation of the `vector` type, and it may be worth merging
//! this module with `llvm::vector` one day. The main difference between a vector and an appender
//! this module with `llvm2::vector` one day. The main difference between a vector and an appender
//! is that an appender has a third capacity field (in addition to the vector's data pointer and
//! size). The appender also contains methods for dynamic resizing.

Expand All @@ -16,10 +16,10 @@ use self::llvm_sys::prelude::*;
use self::llvm_sys::LLVMIntPredicate::*;
use self::llvm_sys::LLVMTypeKind;

use crate::codegen::llvm::intrinsic::Intrinsics;
use crate::codegen::llvm::llvm_exts::*;
use crate::codegen::llvm::CodeGenExt;
use crate::codegen::llvm::LLVM_VECTOR_WIDTH;
use crate::codegen::llvm2::intrinsic::Intrinsics;
use crate::codegen::llvm2::llvm_exts::*;
use crate::codegen::llvm2::CodeGenExt;
use crate::codegen::llvm2::LLVM_VECTOR_WIDTH;

pub const POINTER_INDEX: u32 = 0;
pub const SIZE_INDEX: u32 = 1;
Expand Down Expand Up @@ -307,7 +307,7 @@ impl Appender {
builder_arg: LLVMValueRef,
) -> WeldResult<LLVMValueRef> {
// The vector type that the appender generates.
use crate::codegen::llvm::vector;
use crate::codegen::llvm2::vector;
if self.result.is_none() {
let mut arg_tys = [LLVMPointerType(self.appender_ty, 0)];
let ret_ty = vector_ty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ use self::llvm_sys::core::*;
use self::llvm_sys::prelude::*;
use self::llvm_sys::{LLVMIntPredicate, LLVMLinkage};

use crate::codegen::llvm::llvm_exts::LLVMExtAttribute::*;
use crate::codegen::llvm::llvm_exts::*;
use crate::codegen::llvm::vector::VectorExt;
use crate::codegen::llvm::{LLVM_VECTOR_WIDTH, SIR_FUNC_CALL_CONV};
use crate::codegen::llvm2::llvm_exts::LLVMExtAttribute::*;
use crate::codegen::llvm2::llvm_exts::*;
use crate::codegen::llvm2::vector::VectorExt;
use crate::codegen::llvm2::{LLVM_VECTOR_WIDTH, SIR_FUNC_CALL_CONV};

use super::{CodeGenExt, FunctionContext, LlvmGenerator};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use self::llvm_sys::core::*;
use self::llvm_sys::prelude::*;
use self::llvm_sys::LLVMTypeKind;

use crate::codegen::llvm::llvm_exts::*;
use crate::codegen::llvm::numeric::gen_binop;
use crate::codegen::llvm::CodeGenExt;
use crate::codegen::llvm::LLVM_VECTOR_WIDTH;
use crate::codegen::llvm2::llvm_exts::*;
use crate::codegen::llvm2::numeric::gen_binop;
use crate::codegen::llvm2::CodeGenExt;
use crate::codegen::llvm2::LLVM_VECTOR_WIDTH;

const SCALAR_INDEX: u32 = 0;
const VECTOR_INDEX: u32 = 1;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use std::ffi::CStr;
use crate::ast::BinOpKind::*;
use crate::ast::ScalarKind::I64;
use crate::ast::Type;
use crate::codegen::llvm::numeric::gen_binop;
use crate::codegen::llvm::SIR_FUNC_CALL_CONV;
use crate::codegen::llvm2::numeric::gen_binop;
use crate::codegen::llvm2::SIR_FUNC_CALL_CONV;
use crate::error::*;
use crate::sir::FunctionId;

Expand Down
10 changes: 5 additions & 5 deletions weld/src/codegen/llvm/dict.rs → weld/src/codegen/llvm2/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ use self::llvm_sys::prelude::*;
use self::llvm_sys::LLVMIntPredicate::*;
use self::llvm_sys::LLVMTypeKind;

use crate::codegen::llvm::intrinsic::Intrinsics;
use crate::codegen::llvm::llvm_exts::LLVMExtAttribute::*;
use crate::codegen::llvm::llvm_exts::*;
use crate::codegen::llvm2::intrinsic::Intrinsics;
use crate::codegen::llvm2::llvm_exts::LLVMExtAttribute::*;
use crate::codegen::llvm2::llvm_exts::*;

// Need vector type for ToVec and Serialize.
use crate::codegen::llvm::vector;
use crate::codegen::llvm::vector::Vector;
use crate::codegen::llvm2::vector;
use crate::codegen::llvm2::vector::Vector;

use super::CodeGenExt;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use super::CodeGenExt;
use super::LlvmGenerator;

use crate::ast::BinOpKind::Equal;
use crate::codegen::llvm::numeric::gen_binop;
use crate::codegen::llvm2::numeric::gen_binop;

/// Returns whether a value can be compared with libc's `memcmp`.
///
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ use self::llvm_sys::target_machine::*;

use crate::codegen::Runnable;

use crate::codegen::llvm::intrinsic;
use crate::codegen::llvm::llvm_exts::*;
use crate::codegen::llvm2::intrinsic;
use crate::codegen::llvm2::llvm_exts::*;

static ONCE: Once = ONCE_INIT;
static mut INITIALIZE_FAILED: bool = false;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use self::llvm_sys::core::*;
use self::llvm_sys::prelude::*;
use self::llvm_sys::LLVMIntPredicate::*;

use crate::codegen::llvm::intrinsic::Intrinsics;
use crate::codegen::llvm2::intrinsic::Intrinsics;

use super::{CodeGenExt, FunctionContext, LlvmGenerator, LLVM_VECTOR_WIDTH};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::ffi::CStr;

use crate::ast::Type::*;
use crate::ast::*;
use crate::codegen::llvm::vector::VectorExt;
use crate::codegen::llvm2::vector::VectorExt;
use crate::error::*;
use crate::sir::*;

Expand Down Expand Up @@ -528,7 +528,7 @@ impl DeHelper for LlvmGenerator {
buffer: LLVMValueRef,
position: LLVMValueRef,
) -> WeldResult<(LLVMValueRef, LLVMValueRef)> {
use crate::codegen::llvm::vector::VectorExt;
use crate::codegen::llvm2::vector::VectorExt;

let size = self.size_of(ty);
let pointer = self.gen_at(builder, &SER_TY, buffer, position)?;
Expand All @@ -554,7 +554,7 @@ impl DeHelper for LlvmGenerator {
buffer: LLVMValueRef,
position: LLVMValueRef,
) -> WeldResult<LLVMValueRef> {
use crate::codegen::llvm::vector::VectorExt;
use crate::codegen::llvm2::vector::VectorExt;
let elem_size = self.size_of(LLVMGetElementType(LLVMTypeOf(ptr)));
let size = LLVMBuildNSWMul(builder, size, elem_size, c_str!(""));

Expand Down Expand Up @@ -741,7 +741,7 @@ impl DeHelper for LlvmGenerator {
// NOTE: This requires re-hashing: we could look into encoding dictionaries without
// having to do this.
use self::llvm_sys::LLVMIntPredicate::LLVMIntSGT;
use crate::codegen::llvm::hash::GenHash;
use crate::codegen::llvm2::hash::GenHash;

let size_type = self.i64_type();
let (size, start_position) =
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions weld/src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use crate::util::stats::CompilationStats;

use std::fmt;

mod llvm;
mod llvm2;

pub use self::llvm::load_library;
pub use self::llvm2::load_library;

/// A wrapper for a struct passed as input to Weld.
#[derive(Clone, Debug)]
Expand Down Expand Up @@ -89,12 +89,12 @@ pub fn compile_program(
conf: &mut ParsedConf,
stats: &mut CompilationStats,
) -> WeldResult<CompiledModule> {
let runnable = llvm::compile(&program, conf, stats)?;
let runnable = llvm2::compile(&program, conf, stats)?;
let result = CompiledModule { runnable };
Ok(result)
}

/// Get the size of a value for a given target.
pub fn size_of(ty: &Type) -> usize {
llvm::size_of(ty)
llvm2::size_of(ty)
}

0 comments on commit eb5c1cb

Please sign in to comment.