Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /trunk/doc/field-norm/paper.tex
ViewVC logotype

View of /trunk/doc/field-norm/paper.tex

Parent Directory Parent Directory | Revision Log Revision Log

Revision 469 - (download) (as text) (annotate)
Tue Nov 2 14:12:42 2010 UTC (8 years, 4 months ago) by jhr
File size: 3933 byte(s)
  Added example



\title{Normalization of Field and Probe Expressions}
 John Reppy \\
  University of Chicago \\
  {\small\tt{}jhr@cs.uchicago.edu} \\






This note describes the symbolic transformations that are applied to field and probe expressions in
the Diderot compiler.
The purpose of these transformations is to make the actual compilation of probe operations
more straightforward.
We describe these transformations using three simple expression languages.
The first corresponds to the Diderot surface-language syntax for field and probe expressions.
The second language has the property that derivative operations have been pushed down to the
convolution kernels, and the third language reduces probes to work on images.

\section{The formal model}

In the discussion below, we  use a number of notational conventions that are
summarized in the following table:
    $V$ & an image \\
    $F$, $G$ & fields \\
    $h$ & a piecewise polynomial convolution kernel \\
    $s$ & a scalar \\
    $\vecx$ & a position in world space 

The source language of field expressions is
    F & ::= & V\circledast{}h & \text{convolution} \\
      & \mid & F+G & \text{addition} \\
      & \mid & s F & \text{scaling} \\
      & \mid & \nabla{}F & \text{differentiation}
We normalize these expressions by pushing the differentiation operators down to the
kernels, which results in the following language of field expressions:
    \hat{F} & ::= & V\circledast{}h^k & \text{convolution with $k$th derivative of $h$} \\
      & \mid & \hat{F}+\hat{G } & \text{addition} \\
      & \mid & s \hat{F} & \text{scaling} \\
The normalization rules are as follows:
  \Fnorm{\nabla{}(V\circledast{}h^k)} & = & V\circledast{}h^{k+1} \\
  \Fnorm{\nabla{}(F+G)} & = & \Fnorm{\nabla{}F} + \Fnorm{\nabla{}G} \\
  \Fnorm{\nabla{}(s F)} & = & s (\Fnorm{\nabla{}F})

The syntax of probe operations (after field normalization) is
We normalize these expressions by pushing the probes down to the leaves
and rewriting them as probes into images with the following syntax
The probe normalization rules are as follows:
  \Pnorm{(V\circledast{}h^k)\mkw{@}\vecx} & = & V\mkw{@}_{h^k}\vecx \\
  \Pnorm{(F+G)\mkw{@}\vecx} & = & \Pnorm{F\mkw{@}\vecx} + \Pnorm{G\mkw{@}\vecx} \\
  \Pnorm{(s F)\mkw{@}\vecx} & = & s (\Pnorm{F\mkw{@}\vecx})

\section{An example}
Consider the following Diderot fragment (taken from the \texttt{vr-lite.diderot} example).
field#1(3)[] F = img $\circledast$ bspln3;
real val = F@pos;
vec3 grad = ($\nabla$ F)@pos;
Applying the transformations will result in
real val = img $\mkw{@}_{\mathtt{bspln3}}$ pos;
vec3 grad = img $\mkw{@}_{\mathtt{bspln3}^1}$ pos;

\section{Implementation in the compiler}
These transformations are mostly implemented on the SimpleAST representation.
The final step of translating a probe of $(V\circledast{}h^k)\mkw{@}\vecx$
to $V\mkw{@}_{h^k}\vecx$ is done in the conversion to the HighIL representation.


ViewVC Help
Powered by ViewVC 1.0.0